2001-02-19 21:15:25 +00:00
|
|
|
/*
|
|
|
|
cl_ents.c
|
|
|
|
|
|
|
|
entity parsing and management
|
|
|
|
|
|
|
|
Copyright (C) 1996-1997 Id Software, Inc.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to:
|
|
|
|
|
|
|
|
Free Software Foundation, Inc.
|
|
|
|
59 Temple Place - Suite 330
|
|
|
|
Boston, MA 02111-1307, USA
|
|
|
|
|
|
|
|
*/
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
2003-01-15 15:31:36 +00:00
|
|
|
|
2005-08-04 15:27:09 +00:00
|
|
|
static __attribute__ ((used)) const char rcsid[] =
|
2003-01-15 15:31:36 +00:00
|
|
|
"$Id$";
|
|
|
|
|
2001-02-19 21:15:25 +00:00
|
|
|
#ifdef HAVE_STRING_H
|
|
|
|
# include <string.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_STRINGS_H
|
|
|
|
# include <strings.h>
|
|
|
|
#endif
|
|
|
|
|
2001-05-31 03:41:35 +00:00
|
|
|
#include "QF/cvar.h"
|
2004-03-23 22:39:17 +00:00
|
|
|
#include "QF/locs.h"
|
2001-05-21 00:22:35 +00:00
|
|
|
#include "QF/msg.h"
|
|
|
|
#include "QF/render.h"
|
2001-05-21 22:25:35 +00:00
|
|
|
#include "QF/skin.h"
|
2007-11-06 10:17:14 +00:00
|
|
|
#include "QF/sys.h"
|
2001-05-21 00:22:35 +00:00
|
|
|
|
2004-02-21 05:09:02 +00:00
|
|
|
#include "qw/msg_ucmd.h"
|
|
|
|
|
2005-05-08 08:04:50 +00:00
|
|
|
#include "qw/bothdefs.h"
|
2001-02-19 21:15:25 +00:00
|
|
|
#include "cl_cam.h"
|
|
|
|
#include "cl_ents.h"
|
|
|
|
#include "cl_main.h"
|
2001-05-21 22:25:35 +00:00
|
|
|
#include "cl_parse.h"
|
2001-02-19 21:15:25 +00:00
|
|
|
#include "cl_pred.h"
|
|
|
|
#include "cl_tent.h"
|
2001-08-25 02:47:11 +00:00
|
|
|
#include "compat.h"
|
2001-02-19 21:15:25 +00:00
|
|
|
#include "d_iface.h"
|
|
|
|
#include "host.h"
|
2005-05-02 04:09:15 +00:00
|
|
|
#include "qw/pmove.h"
|
2001-06-29 02:43:04 +00:00
|
|
|
#include "r_cvar.h"
|
2001-02-19 21:15:25 +00:00
|
|
|
#include "r_dynamic.h"
|
|
|
|
#include "view.h"
|
|
|
|
|
|
|
|
static struct predicted_player {
|
|
|
|
int flags;
|
|
|
|
qboolean active;
|
|
|
|
vec3_t origin; // predicted origin
|
|
|
|
} predicted_players[MAX_CLIENTS];
|
|
|
|
|
2001-11-27 21:42:49 +00:00
|
|
|
|
2001-12-03 05:36:39 +00:00
|
|
|
entity_t cl_player_ents[MAX_CLIENTS];
|
2001-11-27 21:42:49 +00:00
|
|
|
entity_t cl_flag_ents[MAX_CLIENTS];
|
2001-12-03 05:36:39 +00:00
|
|
|
entity_t cl_packet_ents[512]; // FIXME: magic number
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-09-10 17:32:22 +00:00
|
|
|
|
2001-02-19 21:15:25 +00:00
|
|
|
void
|
|
|
|
CL_ClearEnts ()
|
|
|
|
{
|
2003-04-17 00:01:48 +00:00
|
|
|
unsigned int i;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-12-03 05:36:39 +00:00
|
|
|
for (i = 0; i < sizeof (cl_packet_ents) / sizeof (cl_packet_ents[0]); i++)
|
|
|
|
CL_Init_Entity (&cl_packet_ents[i]);
|
2001-02-19 21:15:25 +00:00
|
|
|
for (i = 0; i < sizeof (cl_flag_ents) / sizeof (cl_flag_ents[0]); i++)
|
|
|
|
CL_Init_Entity (&cl_flag_ents[i]);
|
2001-12-03 05:36:39 +00:00
|
|
|
for (i = 0; i < sizeof (cl_player_ents) / sizeof (cl_player_ents[0]); i++)
|
|
|
|
CL_Init_Entity (&cl_player_ents[i]);
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2002-06-18 21:41:24 +00:00
|
|
|
CL_NewDlight (int key, vec3_t org, int effects, byte glow_size,
|
|
|
|
byte glow_color)
|
2001-02-19 21:15:25 +00:00
|
|
|
{
|
2001-09-10 17:32:22 +00:00
|
|
|
float radius;
|
2001-08-28 23:05:45 +00:00
|
|
|
dlight_t *dl;
|
2004-05-03 06:21:39 +00:00
|
|
|
static quat_t normal = {0.4, 0.2, 0.05, 0.7};
|
|
|
|
static quat_t red = {0.5, 0.05, 0.05, 0.7};
|
|
|
|
static quat_t blue = {0.05, 0.05, 0.5, 0.7};
|
|
|
|
static quat_t purple = {0.5, 0.05, 0.5, 0.7};
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2003-12-02 23:42:09 +00:00
|
|
|
effects &= EF_BLUE | EF_RED | EF_BRIGHTLIGHT | EF_DIMLIGHT;
|
|
|
|
if (!effects) {
|
2002-06-18 21:41:24 +00:00
|
|
|
if (!glow_size)
|
|
|
|
return;
|
|
|
|
}
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-05-20 05:42:52 +00:00
|
|
|
dl = R_AllocDlight (key);
|
2002-06-05 22:07:38 +00:00
|
|
|
if (!dl)
|
|
|
|
return;
|
2001-02-19 21:15:25 +00:00
|
|
|
VectorCopy (org, dl->origin);
|
2002-06-18 21:41:24 +00:00
|
|
|
|
|
|
|
if (effects & (EF_BLUE | EF_RED | EF_BRIGHTLIGHT | EF_DIMLIGHT)) {
|
|
|
|
radius = 200 + (rand () & 31);
|
|
|
|
if (effects & EF_BRIGHTLIGHT) {
|
|
|
|
radius += 200;
|
|
|
|
dl->origin[2] += 16;
|
|
|
|
}
|
|
|
|
if (effects & EF_DIMLIGHT)
|
|
|
|
if (effects & ~EF_DIMLIGHT)
|
|
|
|
radius -= 100;
|
|
|
|
dl->radius = radius;
|
2002-06-19 17:32:39 +00:00
|
|
|
dl->die = cl.time + 0.1;
|
2002-06-18 21:41:24 +00:00
|
|
|
switch (effects & (EF_RED | EF_BLUE)) {
|
|
|
|
case EF_RED | EF_BLUE:
|
2004-05-03 06:21:39 +00:00
|
|
|
QuatCopy (purple, dl->color);
|
2002-06-18 21:41:24 +00:00
|
|
|
break;
|
|
|
|
case EF_RED:
|
2004-05-03 06:21:39 +00:00
|
|
|
QuatCopy (red, dl->color);
|
2002-06-18 21:41:24 +00:00
|
|
|
break;
|
|
|
|
case EF_BLUE:
|
2004-05-03 06:21:39 +00:00
|
|
|
QuatCopy (blue, dl->color);
|
2002-06-18 21:41:24 +00:00
|
|
|
break;
|
|
|
|
default:
|
2004-05-03 06:21:39 +00:00
|
|
|
QuatCopy (normal, dl->color);
|
2002-06-18 21:41:24 +00:00
|
|
|
break;
|
|
|
|
}
|
2002-06-07 05:21:53 +00:00
|
|
|
}
|
2002-06-18 21:41:24 +00:00
|
|
|
|
|
|
|
if (glow_size) {
|
|
|
|
dl->radius += glow_size < 128 ? glow_size * 8.0 :
|
|
|
|
(glow_size - 256) * 8.0;
|
2002-06-19 17:32:39 +00:00
|
|
|
dl->die = cl.time + 0.1;
|
2002-06-18 21:41:24 +00:00
|
|
|
if (glow_color) {
|
|
|
|
if (glow_color == 255) {
|
|
|
|
dl->color[0] = dl->color[1] = dl->color[2] = 1.0;
|
|
|
|
} else {
|
|
|
|
unsigned char *tempcolor;
|
|
|
|
|
|
|
|
tempcolor = (byte *) &d_8to24table[glow_color];
|
|
|
|
dl->color[0] = tempcolor[0] / 255.0;
|
|
|
|
dl->color[1] = tempcolor[1] / 255.0;
|
|
|
|
dl->color[2] = tempcolor[2] / 255.0;
|
|
|
|
}
|
|
|
|
}
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-07-02 21:37:22 +00:00
|
|
|
// PACKET ENTITY PARSING / LINKING ============================================
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-11-07 08:24:56 +00:00
|
|
|
/*
|
|
|
|
CL_ParseDelta
|
|
|
|
|
|
|
|
Can go from either a baseline or a previous packet_entity
|
|
|
|
*/
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-12-03 05:36:39 +00:00
|
|
|
CL_ParseDelta (entity_state_t *from, entity_state_t *to, int bits)
|
2001-10-21 14:21:30 +00:00
|
|
|
{
|
2001-11-07 08:24:56 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
// set everything to the state we are delta'ing from
|
|
|
|
*to = *from;
|
|
|
|
|
|
|
|
to->number = bits & 511;
|
|
|
|
bits &= ~511;
|
|
|
|
|
|
|
|
if (bits & U_MOREBITS) { // read in the low order bits
|
|
|
|
i = MSG_ReadByte (net_message);
|
|
|
|
bits |= i;
|
|
|
|
}
|
|
|
|
|
|
|
|
// LordHavoc: Endy neglected to mark this as being part of the QSG
|
|
|
|
// version 2 stuff...
|
|
|
|
if (bits & U_EXTEND1) {
|
|
|
|
bits |= MSG_ReadByte (net_message) << 16;
|
|
|
|
if (bits & U_EXTEND2)
|
|
|
|
bits |= MSG_ReadByte (net_message) << 24;
|
|
|
|
}
|
|
|
|
|
|
|
|
to->flags = bits;
|
|
|
|
|
2001-12-03 05:36:39 +00:00
|
|
|
if (bits & U_MODEL)
|
2001-11-07 08:24:56 +00:00
|
|
|
to->modelindex = MSG_ReadByte (net_message);
|
|
|
|
|
2001-12-03 05:36:39 +00:00
|
|
|
if (bits & U_FRAME)
|
2001-11-07 08:24:56 +00:00
|
|
|
to->frame = MSG_ReadByte (net_message);
|
|
|
|
|
2001-10-21 14:21:30 +00:00
|
|
|
if (bits & U_COLORMAP)
|
2001-11-07 08:24:56 +00:00
|
|
|
to->colormap = MSG_ReadByte (net_message);
|
|
|
|
|
2001-12-03 05:36:39 +00:00
|
|
|
if (bits & U_SKIN)
|
2001-11-07 08:24:56 +00:00
|
|
|
to->skinnum = MSG_ReadByte (net_message);
|
|
|
|
|
2001-10-21 14:21:30 +00:00
|
|
|
if (bits & U_EFFECTS)
|
2001-11-07 08:24:56 +00:00
|
|
|
to->effects = MSG_ReadByte (net_message);
|
2001-10-21 14:21:30 +00:00
|
|
|
|
2001-12-03 05:36:39 +00:00
|
|
|
if (bits & U_ORIGIN1)
|
2001-11-07 08:24:56 +00:00
|
|
|
to->origin[0] = MSG_ReadCoord (net_message);
|
|
|
|
|
2001-12-03 05:36:39 +00:00
|
|
|
if (bits & U_ANGLE1)
|
2001-11-07 08:24:56 +00:00
|
|
|
to->angles[0] = MSG_ReadAngle (net_message);
|
|
|
|
|
2001-12-03 05:36:39 +00:00
|
|
|
if (bits & U_ORIGIN2)
|
2001-11-07 08:24:56 +00:00
|
|
|
to->origin[1] = MSG_ReadCoord (net_message);
|
|
|
|
|
2001-12-03 05:36:39 +00:00
|
|
|
if (bits & U_ANGLE2)
|
2001-11-07 08:24:56 +00:00
|
|
|
to->angles[1] = MSG_ReadAngle (net_message);
|
|
|
|
|
2001-12-03 05:36:39 +00:00
|
|
|
if (bits & U_ORIGIN3)
|
2001-11-07 08:24:56 +00:00
|
|
|
to->origin[2] = MSG_ReadCoord (net_message);
|
|
|
|
|
2001-12-03 05:36:39 +00:00
|
|
|
if (bits & U_ANGLE3)
|
2001-11-07 08:24:56 +00:00
|
|
|
to->angles[2] = MSG_ReadAngle (net_message);
|
2001-10-21 14:21:30 +00:00
|
|
|
|
2001-11-15 19:37:29 +00:00
|
|
|
if (bits & U_SOLID) {
|
|
|
|
// FIXME
|
|
|
|
}
|
|
|
|
|
2001-11-28 23:51:49 +00:00
|
|
|
if (!(bits & U_EXTEND1))
|
2001-11-15 19:37:29 +00:00
|
|
|
return;
|
|
|
|
|
2001-11-07 08:24:56 +00:00
|
|
|
// LordHavoc: Endy neglected to mark this as being part of the QSG
|
|
|
|
// version 2 stuff... rearranged it and implemented missing effects
|
|
|
|
// Ender (QSG - Begin)
|
2001-12-03 05:36:39 +00:00
|
|
|
if (bits & U_ALPHA)
|
2001-11-07 08:24:56 +00:00
|
|
|
to->alpha = MSG_ReadByte (net_message);
|
2001-12-03 05:36:39 +00:00
|
|
|
if (bits & U_SCALE)
|
2001-11-07 08:24:56 +00:00
|
|
|
to->scale = MSG_ReadByte (net_message);
|
2001-12-03 05:36:39 +00:00
|
|
|
if (bits & U_EFFECTS2)
|
2001-11-07 08:24:56 +00:00
|
|
|
to->effects = (to->effects & 0xFF) | (MSG_ReadByte (net_message) << 8);
|
2001-12-03 05:36:39 +00:00
|
|
|
if (bits & U_GLOWSIZE)
|
2001-11-07 08:24:56 +00:00
|
|
|
to->glow_size = MSG_ReadByte (net_message);
|
2001-12-03 05:36:39 +00:00
|
|
|
if (bits & U_GLOWCOLOR)
|
2001-11-07 08:24:56 +00:00
|
|
|
to->glow_color = MSG_ReadByte (net_message);
|
2001-12-03 05:36:39 +00:00
|
|
|
if (bits & U_COLORMOD)
|
2001-11-07 08:24:56 +00:00
|
|
|
to->colormod = MSG_ReadByte (net_message);
|
2001-11-15 19:37:29 +00:00
|
|
|
|
2001-11-28 23:51:49 +00:00
|
|
|
if (!(bits & U_EXTEND2))
|
2001-11-15 19:37:29 +00:00
|
|
|
return;
|
|
|
|
|
2001-12-03 05:36:39 +00:00
|
|
|
if (bits & U_FRAME2)
|
2001-11-07 08:24:56 +00:00
|
|
|
to->frame = (to->frame & 0xFF) | (MSG_ReadByte (net_message) << 8);
|
|
|
|
// Ender (QSG - End)
|
2001-10-21 14:21:30 +00:00
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-11-07 08:24:56 +00:00
|
|
|
FlushEntityPacket (void)
|
2001-10-21 14:21:30 +00:00
|
|
|
{
|
2001-11-07 08:24:56 +00:00
|
|
|
entity_state_t olde, newe;
|
|
|
|
int word;
|
2001-10-21 14:21:30 +00:00
|
|
|
|
2010-11-23 05:09:30 +00:00
|
|
|
Sys_MaskPrintf (SYS_DEV, "FlushEntityPacket\n");
|
2001-10-21 14:21:30 +00:00
|
|
|
|
2001-11-07 08:24:56 +00:00
|
|
|
memset (&olde, 0, sizeof (olde));
|
2001-10-21 14:21:30 +00:00
|
|
|
|
2001-11-07 08:24:56 +00:00
|
|
|
cl.validsequence = 0; // can't render a frame
|
|
|
|
cl.frames[cls.netchan.incoming_sequence & UPDATE_MASK].invalid = true;
|
2001-10-21 14:21:30 +00:00
|
|
|
|
2001-11-07 08:24:56 +00:00
|
|
|
// read it all, but ignore it
|
|
|
|
while (1) {
|
|
|
|
word = (unsigned short) MSG_ReadShort (net_message);
|
2002-07-03 00:37:28 +00:00
|
|
|
if (net_message->badread) { // something didn't parse right...
|
2001-11-12 20:46:11 +00:00
|
|
|
Host_Error ("msg_badread in packetentities");
|
2001-10-21 14:21:30 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2001-11-07 08:24:56 +00:00
|
|
|
if (!word)
|
|
|
|
break; // done
|
2001-10-21 14:21:30 +00:00
|
|
|
|
2001-12-03 05:36:39 +00:00
|
|
|
CL_ParseDelta (&olde, &newe, word);
|
2001-10-21 14:21:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-02-19 21:15:25 +00:00
|
|
|
void
|
2001-11-07 08:24:56 +00:00
|
|
|
CL_ParsePacketEntities (qboolean delta)
|
2001-02-19 21:15:25 +00:00
|
|
|
{
|
2001-11-07 08:24:56 +00:00
|
|
|
byte from;
|
|
|
|
int oldindex, newindex, newnum, oldnum, oldpacket, newpacket, word;
|
|
|
|
packet_entities_t *oldp, *newp, dummy;
|
|
|
|
qboolean full;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
newpacket = cls.netchan.incoming_sequence & UPDATE_MASK;
|
|
|
|
newp = &cl.frames[newpacket].packet_entities;
|
|
|
|
cl.frames[newpacket].invalid = false;
|
|
|
|
|
2001-11-07 08:24:56 +00:00
|
|
|
if (delta) {
|
|
|
|
from = MSG_ReadByte (net_message);
|
2001-10-30 00:24:25 +00:00
|
|
|
|
2001-11-07 08:24:56 +00:00
|
|
|
oldpacket = cl.frames[newpacket].delta_sequence;
|
2002-10-02 21:56:45 +00:00
|
|
|
if (cls.demoplayback2)
|
|
|
|
from = oldpacket = (cls.netchan.incoming_sequence - 1);
|
2001-11-07 08:24:56 +00:00
|
|
|
if ((from & UPDATE_MASK) != (oldpacket & UPDATE_MASK))
|
2010-11-23 05:09:30 +00:00
|
|
|
Sys_MaskPrintf (SYS_DEV, "WARNING: from mismatch\n");
|
2001-11-07 08:24:56 +00:00
|
|
|
} else
|
|
|
|
oldpacket = -1;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-11-07 08:24:56 +00:00
|
|
|
full = false;
|
|
|
|
if (oldpacket != -1) {
|
|
|
|
if (cls.netchan.outgoing_sequence - oldpacket >= UPDATE_BACKUP - 1) {
|
|
|
|
// we can't use this, it is too old
|
|
|
|
FlushEntityPacket ();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
cl.validsequence = cls.netchan.incoming_sequence;
|
|
|
|
oldp = &cl.frames[oldpacket & UPDATE_MASK].packet_entities;
|
|
|
|
} else { // a full update that we can start delta compressing from now
|
|
|
|
oldp = &dummy;
|
|
|
|
dummy.num_entities = 0;
|
|
|
|
cl.validsequence = cls.netchan.incoming_sequence;
|
|
|
|
full = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
oldindex = 0;
|
|
|
|
newindex = 0;
|
2001-02-19 21:15:25 +00:00
|
|
|
newp->num_entities = 0;
|
|
|
|
|
2001-11-07 08:24:56 +00:00
|
|
|
while (1) {
|
|
|
|
word = (unsigned short) MSG_ReadShort (net_message);
|
2002-07-03 00:37:28 +00:00
|
|
|
if (net_message->badread) { // something didn't parse right...
|
2001-11-12 20:46:11 +00:00
|
|
|
Host_Error ("msg_badread in packetentities");
|
2001-11-07 08:24:56 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2002-07-03 00:37:28 +00:00
|
|
|
if (!word) { // copy rest of ents from old packet
|
2001-11-07 08:24:56 +00:00
|
|
|
while (oldindex < oldp->num_entities) {
|
2002-10-17 16:03:18 +00:00
|
|
|
if (newindex >= MAX_DEMO_PACKET_ENTITIES)
|
2001-11-12 20:46:11 +00:00
|
|
|
Host_Error ("CL_ParsePacketEntities: newindex == "
|
2002-10-17 16:03:18 +00:00
|
|
|
"MAX_DEMO_PACKET_ENTITIES");
|
2001-11-07 08:24:56 +00:00
|
|
|
newp->entities[newindex] = oldp->entities[oldindex];
|
|
|
|
newindex++;
|
|
|
|
oldindex++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
newnum = word & 511;
|
2001-08-25 02:47:11 +00:00
|
|
|
oldnum = oldindex >= oldp->num_entities ? 9999 :
|
|
|
|
oldp->entities[oldindex].number;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-11-07 08:24:56 +00:00
|
|
|
while (newnum > oldnum) {
|
|
|
|
if (full) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("WARNING: oldcopy on full update");
|
2001-11-07 08:24:56 +00:00
|
|
|
FlushEntityPacket ();
|
2001-10-21 14:21:30 +00:00
|
|
|
return;
|
|
|
|
}
|
2001-11-07 08:24:56 +00:00
|
|
|
// copy one of the old entities over to the new packet unchanged
|
2002-10-17 16:03:18 +00:00
|
|
|
if (newindex >= MAX_DEMO_PACKET_ENTITIES)
|
2001-11-12 20:46:11 +00:00
|
|
|
Host_Error ("CL_ParsePacketEntities: newindex == "
|
2002-10-17 16:03:18 +00:00
|
|
|
"MAX_DEMO_PACKET_ENTITIES");
|
2001-02-19 21:15:25 +00:00
|
|
|
newp->entities[newindex] = oldp->entities[oldindex];
|
|
|
|
newindex++;
|
|
|
|
oldindex++;
|
2001-08-25 02:47:11 +00:00
|
|
|
oldnum = oldindex >= oldp->num_entities ? 9999 :
|
|
|
|
oldp->entities[oldindex].number;
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
2002-07-03 00:37:28 +00:00
|
|
|
if (newnum < oldnum) { // new from baseline
|
2001-11-07 08:24:56 +00:00
|
|
|
if (word & U_REMOVE) {
|
|
|
|
if (full) {
|
|
|
|
cl.validsequence = 0;
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("WARNING: U_REMOVE on full update\n");
|
2001-11-07 08:24:56 +00:00
|
|
|
FlushEntityPacket ();
|
|
|
|
return;
|
|
|
|
}
|
2001-02-19 21:15:25 +00:00
|
|
|
continue;
|
|
|
|
}
|
2001-05-14 05:16:59 +00:00
|
|
|
|
2002-10-17 16:03:18 +00:00
|
|
|
if (newindex >= MAX_DEMO_PACKET_ENTITIES)
|
2001-11-12 20:46:11 +00:00
|
|
|
Host_Error ("CL_ParsePacketEntities: newindex == "
|
2002-10-17 16:03:18 +00:00
|
|
|
"MAX_DEMO_PACKET_ENTITIES");
|
2001-11-07 08:24:56 +00:00
|
|
|
CL_ParseDelta (&cl_baselines[newnum], &newp->entities[newindex],
|
2001-12-03 05:36:39 +00:00
|
|
|
word);
|
2001-02-19 21:15:25 +00:00
|
|
|
newindex++;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2002-07-03 00:37:28 +00:00
|
|
|
if (newnum == oldnum) { // delta from previous
|
2001-11-07 08:24:56 +00:00
|
|
|
if (full) {
|
|
|
|
cl.validsequence = 0;
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("WARNING: delta on full update");
|
2001-11-07 08:24:56 +00:00
|
|
|
}
|
2002-07-03 00:37:28 +00:00
|
|
|
if (word & U_REMOVE) { // Clear the entity
|
2001-12-03 05:36:39 +00:00
|
|
|
entity_t *ent = &cl_packet_ents[newnum];
|
|
|
|
memset (ent, 0, sizeof (entity_t));
|
2001-02-19 21:15:25 +00:00
|
|
|
oldindex++;
|
|
|
|
continue;
|
|
|
|
}
|
2001-11-07 08:24:56 +00:00
|
|
|
CL_ParseDelta (&oldp->entities[oldindex],
|
2001-12-03 05:36:39 +00:00
|
|
|
&newp->entities[newindex], word);
|
2001-02-19 21:15:25 +00:00
|
|
|
newindex++;
|
|
|
|
oldindex++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
newp->num_entities = newindex;
|
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-19 21:15:25 +00:00
|
|
|
CL_LinkPacketEntities (void)
|
|
|
|
{
|
2001-09-10 17:32:22 +00:00
|
|
|
int pnum, i;
|
|
|
|
dlight_t *dl;
|
|
|
|
entity_t **ent;
|
2001-02-19 21:15:25 +00:00
|
|
|
entity_state_t *s1;
|
2001-09-10 17:32:22 +00:00
|
|
|
model_t *model;
|
|
|
|
packet_entities_t *pack;
|
2001-12-03 05:36:39 +00:00
|
|
|
player_info_t *info;
|
2001-09-10 17:32:22 +00:00
|
|
|
|
2001-08-25 02:47:11 +00:00
|
|
|
pack = &cl.frames[cls.netchan.incoming_sequence &
|
|
|
|
UPDATE_MASK].packet_entities;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
for (pnum = 0; pnum < pack->num_entities; pnum++) {
|
|
|
|
s1 = &pack->entities[pnum];
|
|
|
|
|
|
|
|
// spawn light flashes, even ones coming from invisible objects
|
2002-06-18 21:41:24 +00:00
|
|
|
CL_NewDlight (s1->number, s1->origin, s1->effects, s1->glow_size,
|
|
|
|
s1->glow_color);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
// if set to invisible, skip
|
|
|
|
if (!s1->modelindex)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
// Hack hack hack
|
2001-08-25 02:47:11 +00:00
|
|
|
if (cl_deadbodyfilter->int_val && s1->modelindex == cl_playerindex &&
|
|
|
|
((i = s1->frame) == 49 || i == 60 || i == 69 || i == 84 ||
|
|
|
|
i == 93 || i == 102))
|
2001-02-19 21:15:25 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
if (cl_gibfilter->int_val &&
|
2001-08-25 02:47:11 +00:00
|
|
|
(s1->modelindex == cl_h_playerindex || s1->modelindex ==
|
|
|
|
cl_gib1index || s1->modelindex == cl_gib2index ||
|
|
|
|
s1->modelindex == cl_gib3index))
|
2001-02-19 21:15:25 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
// create a new entity
|
2001-05-20 02:39:56 +00:00
|
|
|
ent = R_NewEntity ();
|
2001-02-19 21:15:25 +00:00
|
|
|
if (!ent)
|
|
|
|
break; // object list is full
|
|
|
|
|
2001-12-03 05:36:39 +00:00
|
|
|
*ent = &cl_packet_ents[s1->number];
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-12-03 05:36:39 +00:00
|
|
|
(*ent)->model = model = cl.model_precache[s1->modelindex];
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2004-07-11 01:41:01 +00:00
|
|
|
(*ent)->min_light = 0;
|
|
|
|
(*ent)->fullbright = 0;
|
|
|
|
|
|
|
|
if (s1->modelindex == cl_playerindex) {
|
|
|
|
(*ent)->min_light = min (cl.fbskins, cl_fb_players->value);
|
|
|
|
if ((*ent)->min_light >= 1.0)
|
|
|
|
(*ent)->fullbright = 1;
|
|
|
|
}
|
|
|
|
|
2001-12-03 05:36:39 +00:00
|
|
|
// set colormap
|
|
|
|
if (s1->colormap && (s1->colormap <= MAX_CLIENTS)
|
|
|
|
&& cl.players[s1->colormap - 1].name[0]
|
|
|
|
&& !strcmp ((*ent)->model->name, "progs/player.mdl")) {
|
|
|
|
(*ent)->colormap = cl.players[s1->colormap - 1].translations;
|
|
|
|
info = &cl.players[s1->colormap - 1];
|
|
|
|
} else {
|
|
|
|
(*ent)->colormap = vid.colormap8;
|
|
|
|
info = NULL;
|
|
|
|
}
|
|
|
|
|
2002-03-12 19:44:10 +00:00
|
|
|
if (info && info->skinname && !info->skin)
|
2001-12-03 05:36:39 +00:00
|
|
|
Skin_Find (info);
|
|
|
|
if (info && info->skin) {
|
|
|
|
(*ent)->skin = Skin_NewTempSkin ();
|
|
|
|
if ((*ent)->skin) {
|
|
|
|
i = s1->colormap - 1;
|
|
|
|
CL_NewTranslation (i, (*ent)->skin);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
(*ent)->skin = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
// LordHavoc: cleaned up Endy's coding style, and fixed Endy's bugs
|
|
|
|
// Ender: Extend (Colormod) [QSG - Begin]
|
|
|
|
// N.B: All messy code below is the sole fault of LordHavoc and
|
|
|
|
// his futile attempts to save bandwidth. :)
|
|
|
|
if (s1->colormod == 255) {
|
|
|
|
(*ent)->colormod[0] = (*ent)->colormod[1] =
|
2002-06-07 11:25:47 +00:00
|
|
|
(*ent)->colormod[2] = 1.0;
|
2001-12-03 05:36:39 +00:00
|
|
|
} else {
|
2002-06-10 23:05:29 +00:00
|
|
|
(*ent)->colormod[0] = (float) ((s1->colormod >> 5) & 7) *
|
|
|
|
(1.0 / 7.0);
|
|
|
|
(*ent)->colormod[1] = (float) ((s1->colormod >> 2) & 7) *
|
|
|
|
(1.0 / 7.0);
|
2001-12-03 05:36:39 +00:00
|
|
|
(*ent)->colormod[2] = (float) (s1->colormod & 3) * (1.0 / 3.0);
|
2001-12-02 00:38:44 +00:00
|
|
|
}
|
2002-06-07 11:25:47 +00:00
|
|
|
(*ent)->colormod[3] = s1->alpha / 255.0;
|
|
|
|
(*ent)->scale = s1->scale / 16.0;
|
2001-12-03 05:36:39 +00:00
|
|
|
// Ender: Extend (Colormod) [QSG - End]
|
|
|
|
|
|
|
|
// set skin
|
|
|
|
(*ent)->skinnum = s1->skinnum;
|
|
|
|
|
|
|
|
// set frame
|
|
|
|
(*ent)->frame = s1->frame;
|
2002-03-14 21:33:56 +00:00
|
|
|
|
2001-12-03 05:36:39 +00:00
|
|
|
if ((*ent)->visframe != r_framecount - 1) {
|
2010-11-26 00:22:04 +00:00
|
|
|
(*ent)->lerpflags |= LERP_RESETMOVE|LERP_RESETANIM;
|
2002-03-14 21:33:56 +00:00
|
|
|
|
|
|
|
// No trail if new this frame
|
|
|
|
VectorCopy (s1->origin, (*ent)->origin);
|
|
|
|
VectorCopy ((*ent)->origin, (*ent)->old_origin);
|
|
|
|
} else {
|
|
|
|
VectorCopy ((*ent)->origin, (*ent)->old_origin);
|
|
|
|
VectorCopy (s1->origin, (*ent)->origin);
|
2001-12-03 05:36:39 +00:00
|
|
|
}
|
|
|
|
(*ent)->visframe = r_framecount;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2002-07-03 00:37:28 +00:00
|
|
|
if (model->flags & EF_ROTATE) { // rotate binary objects locally
|
2001-02-19 21:15:25 +00:00
|
|
|
(*ent)->angles[0] = 0;
|
|
|
|
(*ent)->angles[1] = anglemod (100 * cl.time);
|
|
|
|
(*ent)->angles[2] = 0;
|
2001-12-03 05:36:39 +00:00
|
|
|
} else {
|
2003-03-21 21:25:44 +00:00
|
|
|
VectorCopy (s1->angles, (*ent)->angles);
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// add automatic particle trails
|
|
|
|
if (!model->flags)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (model->flags & EF_ROCKET) {
|
2001-11-25 06:24:26 +00:00
|
|
|
dl = R_AllocDlight (-s1->number);
|
2002-06-05 22:07:38 +00:00
|
|
|
if (dl) {
|
|
|
|
VectorCopy ((*ent)->origin, dl->origin);
|
2002-06-18 21:41:24 +00:00
|
|
|
dl->radius = 200.0;
|
2002-06-05 22:07:38 +00:00
|
|
|
dl->die = cl.time + 0.1;
|
2002-06-07 05:21:53 +00:00
|
|
|
VectorCopy (r_firecolor->vec, dl->color);
|
2004-05-03 06:21:39 +00:00
|
|
|
dl->color[3] = 0.7;
|
2002-06-05 22:07:38 +00:00
|
|
|
}
|
2001-09-07 05:37:11 +00:00
|
|
|
R_RocketTrail (*ent);
|
2002-06-10 23:05:29 +00:00
|
|
|
} else if (model->flags & EF_GRENADE)
|
2001-09-07 05:37:11 +00:00
|
|
|
R_GrenadeTrail (*ent);
|
2001-02-19 21:15:25 +00:00
|
|
|
else if (model->flags & EF_GIB)
|
2001-09-07 05:37:11 +00:00
|
|
|
R_BloodTrail (*ent);
|
2001-02-19 21:15:25 +00:00
|
|
|
else if (model->flags & EF_ZOMGIB)
|
2001-09-07 05:37:11 +00:00
|
|
|
R_SlightBloodTrail (*ent);
|
2001-02-19 21:15:25 +00:00
|
|
|
else if (model->flags & EF_TRACER)
|
2001-12-11 22:37:30 +00:00
|
|
|
R_WizTrail (*ent);
|
2001-02-19 21:15:25 +00:00
|
|
|
else if (model->flags & EF_TRACER2)
|
2001-09-07 05:37:11 +00:00
|
|
|
R_FlameTrail (*ent);
|
2001-02-19 21:15:25 +00:00
|
|
|
else if (model->flags & EF_TRACER3)
|
2001-09-07 05:37:11 +00:00
|
|
|
R_VoorTrail (*ent);
|
2002-07-25 14:43:36 +00:00
|
|
|
else if (model->flags & EF_GLOWTRAIL)
|
2002-09-12 22:09:55 +00:00
|
|
|
R_GlowTrail (*ent, s1->glow_color);
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static int
|
2002-10-02 21:56:45 +00:00
|
|
|
TranslateFlags (int src)
|
|
|
|
{
|
|
|
|
int dst = 0;
|
|
|
|
|
|
|
|
if (src & DF_EFFECTS)
|
|
|
|
dst |= PF_EFFECTS;
|
|
|
|
if (src & DF_SKINNUM)
|
|
|
|
dst |= PF_SKINNUM;
|
|
|
|
if (src & DF_DEAD)
|
|
|
|
dst |= PF_DEAD;
|
|
|
|
if (src & DF_GIB)
|
|
|
|
dst |= PF_GIB;
|
|
|
|
if (src & DF_WEAPONFRAME)
|
|
|
|
dst |= PF_WEAPONFRAME;
|
|
|
|
if (src & DF_MODEL)
|
|
|
|
dst |= PF_MODEL;
|
|
|
|
|
|
|
|
return dst;
|
|
|
|
}
|
|
|
|
|
2010-12-02 08:11:33 +00:00
|
|
|
static void
|
|
|
|
CL_ParseDemoPlayerinfo (int num)
|
2001-02-19 21:15:25 +00:00
|
|
|
{
|
2010-12-02 08:11:33 +00:00
|
|
|
int flags, i;
|
2002-10-02 21:56:45 +00:00
|
|
|
player_info_t *info;
|
|
|
|
player_state_t *state, *prevstate;
|
|
|
|
static player_state_t dummy;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2002-10-02 21:56:45 +00:00
|
|
|
info = &cl.players[num];
|
2001-11-07 08:24:56 +00:00
|
|
|
state = &cl.frames[parsecountmod].playerstate[num];
|
2001-10-19 21:20:49 +00:00
|
|
|
|
2005-04-30 03:59:23 +00:00
|
|
|
state->pls.number = num;
|
2002-10-02 21:56:45 +00:00
|
|
|
|
2010-12-02 08:11:33 +00:00
|
|
|
if (info->prevcount > cl.parsecount || !cl.parsecount) {
|
|
|
|
prevstate = &dummy;
|
|
|
|
} else {
|
|
|
|
if (cl.parsecount - info->prevcount >= UPDATE_BACKUP-1)
|
2002-10-02 21:56:45 +00:00
|
|
|
prevstate = &dummy;
|
2010-12-02 08:11:33 +00:00
|
|
|
else
|
|
|
|
prevstate = &cl.frames[info->prevcount
|
|
|
|
& UPDATE_MASK].playerstate[num];
|
|
|
|
}
|
|
|
|
info->prevcount = cl.parsecount;
|
2002-10-02 21:56:45 +00:00
|
|
|
|
2010-12-02 08:11:33 +00:00
|
|
|
if (cls.findtrack && info->stats[STAT_HEALTH] != 0) {
|
|
|
|
autocam = CAM_TRACK;
|
|
|
|
Cam_Lock (num);
|
|
|
|
ideal_track = num;
|
|
|
|
cls.findtrack = false;
|
|
|
|
}
|
2002-10-02 21:56:45 +00:00
|
|
|
|
2010-12-02 08:11:33 +00:00
|
|
|
memcpy (state, prevstate, sizeof (player_state_t));
|
2002-10-02 21:56:45 +00:00
|
|
|
|
2010-12-02 08:11:33 +00:00
|
|
|
flags = MSG_ReadShort (net_message);
|
|
|
|
state->pls.flags = TranslateFlags (flags);
|
|
|
|
state->messagenum = cl.parsecount;
|
|
|
|
state->pls.cmd.msec = 0;
|
|
|
|
state->pls.frame = MSG_ReadByte (net_message);
|
|
|
|
state->state_time = parsecounttime;
|
|
|
|
for (i=0; i <3; i++)
|
|
|
|
if (flags & (DF_ORIGIN << i))
|
|
|
|
state->pls.origin[i] = MSG_ReadCoord (net_message);
|
|
|
|
for (i=0; i <3; i++)
|
|
|
|
if (flags & (DF_ANGLES << i))
|
|
|
|
state->pls.cmd.angles[i] = MSG_ReadAngle16 (net_message);
|
|
|
|
if (flags & DF_MODEL)
|
|
|
|
state->pls.modelindex = MSG_ReadByte (net_message);
|
|
|
|
if (flags & DF_SKINNUM)
|
|
|
|
state->pls.skinnum = MSG_ReadByte (net_message);
|
|
|
|
if (flags & DF_EFFECTS)
|
|
|
|
state->pls.effects = MSG_ReadByte (net_message);
|
|
|
|
if (flags & DF_WEAPONFRAME)
|
|
|
|
state->pls.weaponframe = MSG_ReadByte (net_message);
|
|
|
|
VectorCopy (state->pls.cmd.angles, state->viewangles);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CL_ParsePlayerinfo (void)
|
|
|
|
{
|
|
|
|
int flags, msec, num, i;
|
|
|
|
player_info_t *info;
|
|
|
|
player_state_t *state;
|
|
|
|
|
|
|
|
num = MSG_ReadByte (net_message);
|
|
|
|
if (num > MAX_CLIENTS)
|
|
|
|
Host_Error ("CL_ParsePlayerinfo: bad num");
|
|
|
|
|
|
|
|
if (cls.demoplayback2) {
|
|
|
|
CL_ParseDemoPlayerinfo (num);
|
2002-10-02 21:56:45 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-12-02 08:11:33 +00:00
|
|
|
info = &cl.players[num];
|
|
|
|
state = &cl.frames[parsecountmod].playerstate[num];
|
|
|
|
|
|
|
|
state->pls.number = num;
|
|
|
|
|
2005-04-30 03:59:23 +00:00
|
|
|
flags = state->pls.flags = MSG_ReadShort (net_message);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
state->messagenum = cl.parsecount;
|
2005-04-30 03:59:23 +00:00
|
|
|
MSG_ReadCoordV (net_message, state->pls.origin);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2005-04-30 03:59:23 +00:00
|
|
|
state->pls.frame = MSG_ReadByte (net_message);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
// the other player's last move was likely some time
|
|
|
|
// before the packet was sent out, so accurately track
|
|
|
|
// the exact time it was valid at
|
2001-11-07 08:24:56 +00:00
|
|
|
if (flags & PF_MSEC) {
|
|
|
|
msec = MSG_ReadByte (net_message);
|
|
|
|
state->state_time = parsecounttime - msec * 0.001;
|
|
|
|
} else
|
|
|
|
state->state_time = parsecounttime;
|
|
|
|
|
|
|
|
if (flags & PF_COMMAND)
|
2005-04-30 03:59:23 +00:00
|
|
|
MSG_ReadDeltaUsercmd (net_message, &nullcmd, &state->pls.cmd);
|
2001-11-07 08:24:56 +00:00
|
|
|
|
|
|
|
for (i = 0; i < 3; i++) {
|
|
|
|
if (flags & (PF_VELOCITY1 << i))
|
2005-04-30 03:59:23 +00:00
|
|
|
state->pls.velocity[i] = MSG_ReadShort (net_message);
|
2001-11-07 08:24:56 +00:00
|
|
|
else
|
2005-04-30 03:59:23 +00:00
|
|
|
state->pls.velocity[i] = 0;
|
2001-11-07 08:24:56 +00:00
|
|
|
}
|
|
|
|
if (flags & PF_MODEL)
|
2001-11-27 21:42:49 +00:00
|
|
|
i = MSG_ReadByte (net_message);
|
2001-11-07 08:24:56 +00:00
|
|
|
else
|
2001-11-27 21:42:49 +00:00
|
|
|
i = cl_playerindex;
|
2005-04-30 03:59:23 +00:00
|
|
|
state->pls.modelindex = i;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-11-07 08:24:56 +00:00
|
|
|
if (flags & PF_SKINNUM)
|
2005-04-30 03:59:23 +00:00
|
|
|
state->pls.skinnum = MSG_ReadByte (net_message);
|
2001-11-07 08:24:56 +00:00
|
|
|
else
|
2005-04-30 03:59:23 +00:00
|
|
|
state->pls.skinnum = 0;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-11-07 08:24:56 +00:00
|
|
|
if (flags & PF_EFFECTS)
|
2005-04-30 03:59:23 +00:00
|
|
|
state->pls.effects = MSG_ReadByte (net_message);
|
2001-02-19 21:15:25 +00:00
|
|
|
else
|
2005-04-30 03:59:23 +00:00
|
|
|
state->pls.effects = 0;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2001-11-07 08:24:56 +00:00
|
|
|
if (flags & PF_WEAPONFRAME)
|
2005-04-30 03:59:23 +00:00
|
|
|
state->pls.weaponframe = MSG_ReadByte (net_message);
|
2001-11-07 08:24:56 +00:00
|
|
|
else
|
2005-04-30 03:59:23 +00:00
|
|
|
state->pls.weaponframe = 0;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2005-04-30 03:59:23 +00:00
|
|
|
VectorCopy (state->pls.cmd.angles, state->viewangles);
|
2002-06-19 02:55:57 +00:00
|
|
|
|
2003-09-24 04:01:34 +00:00
|
|
|
if (cl.stdver >= 2.0 && (flags & PF_QF)) {
|
2002-06-19 02:55:57 +00:00
|
|
|
// QSG2
|
|
|
|
int bits;
|
|
|
|
byte val;
|
|
|
|
entity_t *ent;
|
|
|
|
|
|
|
|
ent = &cl_player_ents[num];
|
|
|
|
bits = MSG_ReadByte (net_message);
|
|
|
|
if (bits & PF_ALPHA) {
|
|
|
|
val = MSG_ReadByte (net_message);
|
|
|
|
ent->colormod[3] = val / 255.0;
|
|
|
|
}
|
|
|
|
if (bits & PF_SCALE) {
|
|
|
|
val = MSG_ReadByte (net_message);
|
|
|
|
ent->scale = val / 16.0;
|
|
|
|
}
|
|
|
|
if (bits & PF_EFFECTS2) {
|
2005-04-30 03:59:23 +00:00
|
|
|
state->pls.effects |= MSG_ReadByte (net_message) << 8;
|
2002-06-19 02:55:57 +00:00
|
|
|
}
|
|
|
|
if (bits & PF_GLOWSIZE) {
|
2005-04-30 03:59:23 +00:00
|
|
|
state->pls.glow_size = MSG_ReadByte (net_message);
|
2002-06-19 02:55:57 +00:00
|
|
|
}
|
|
|
|
if (bits & PF_GLOWCOLOR) {
|
2005-04-30 03:59:23 +00:00
|
|
|
state->pls.glow_color = MSG_ReadByte (net_message);
|
2002-06-19 02:55:57 +00:00
|
|
|
}
|
|
|
|
if (bits & PF_COLORMOD) {
|
2010-12-02 08:11:33 +00:00
|
|
|
float r = 1.0, g = 1.0, b = 1.0;
|
2002-06-19 02:55:57 +00:00
|
|
|
val = MSG_ReadByte (net_message);
|
2010-12-02 08:11:33 +00:00
|
|
|
if (val != 255) {
|
|
|
|
r = (float) ((val >> 5) & 7) * (1.0 / 7.0);
|
|
|
|
g = (float) ((val >> 2) & 7) * (1.0 / 7.0);
|
|
|
|
b = (float) (val & 3) * (1.0 / 3.0);
|
2002-06-19 02:55:57 +00:00
|
|
|
}
|
2010-12-02 08:11:33 +00:00
|
|
|
VectorSet (r, g, b, ent->colormod);
|
2002-06-19 02:55:57 +00:00
|
|
|
}
|
|
|
|
if (bits & PF_FRAME2) {
|
2005-04-30 03:59:23 +00:00
|
|
|
state->pls.frame |= MSG_ReadByte (net_message) << 8;
|
2002-06-19 02:55:57 +00:00
|
|
|
}
|
|
|
|
}
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
CL_AddFlagModels
|
|
|
|
|
2010-12-02 08:11:33 +00:00
|
|
|
Called when the CTF flags are set. Flags are effectively temp entities.
|
2001-02-19 21:15:25 +00:00
|
|
|
*/
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-11-25 06:24:26 +00:00
|
|
|
CL_AddFlagModels (entity_t *ent, int team, int key)
|
2001-02-19 21:15:25 +00:00
|
|
|
{
|
2002-08-06 03:52:38 +00:00
|
|
|
static float flag_offsets[] = {
|
|
|
|
16.0, 22.0, 26.0, 25.0, 24.0, 18.0, // 29-34 axpain
|
|
|
|
16.0, 24.0, 24.0, 22.0, 18.0, 16.0, // 35-40 pain
|
|
|
|
};
|
2001-09-10 17:32:22 +00:00
|
|
|
float f;
|
|
|
|
int i;
|
2001-08-28 23:05:45 +00:00
|
|
|
entity_t **newent;
|
2001-09-10 17:32:22 +00:00
|
|
|
vec3_t v_forward, v_right, v_up;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
if (cl_flagindex == -1)
|
|
|
|
return;
|
|
|
|
|
2002-06-30 16:19:37 +00:00
|
|
|
f = 14.0;
|
2001-02-19 21:15:25 +00:00
|
|
|
if (ent->frame >= 29 && ent->frame <= 40) {
|
2002-08-06 03:52:38 +00:00
|
|
|
f = flag_offsets[ent->frame - 29];
|
2001-02-19 21:15:25 +00:00
|
|
|
} else if (ent->frame >= 103 && ent->frame <= 118) {
|
2002-08-03 17:20:07 +00:00
|
|
|
if (ent->frame <= 106) // 103-104 nailattack
|
2002-07-02 18:07:51 +00:00
|
|
|
f = 20.0; // 105-106 light
|
2002-08-03 17:20:07 +00:00
|
|
|
else // 107-112 rocketattack
|
|
|
|
f = 21.0; // 112-118 shotattack
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
2001-05-20 02:39:56 +00:00
|
|
|
newent = R_NewEntity ();
|
2001-02-19 21:15:25 +00:00
|
|
|
if (!newent)
|
|
|
|
return;
|
2001-11-25 06:24:26 +00:00
|
|
|
*newent = &cl_flag_ents[key];
|
2001-02-19 21:15:25 +00:00
|
|
|
(*newent)->model = cl.model_precache[cl_flagindex];
|
|
|
|
(*newent)->skinnum = team;
|
|
|
|
|
|
|
|
AngleVectors (ent->angles, v_forward, v_right, v_up);
|
|
|
|
v_forward[2] = -v_forward[2]; // reverse z component
|
|
|
|
for (i = 0; i < 3; i++)
|
2002-06-30 16:19:37 +00:00
|
|
|
(*newent)->origin[i] = ent->origin[i] - f * v_forward[i] +
|
|
|
|
22.0 * v_right[i];
|
|
|
|
(*newent)->origin[2] -= 16.0;
|
|
|
|
VectorCopy (ent->angles, (*newent)->angles);
|
|
|
|
(*newent)->angles[2] -= 45.0;
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
CL_LinkPlayers
|
|
|
|
|
|
|
|
Create visible entities in the correct position
|
|
|
|
for all current players
|
|
|
|
*/
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-02-19 21:15:25 +00:00
|
|
|
CL_LinkPlayers (void)
|
|
|
|
{
|
2001-09-10 17:32:22 +00:00
|
|
|
double playertime;
|
|
|
|
int msec, oldphysent, i, j;
|
2001-11-15 19:37:29 +00:00
|
|
|
entity_t *ent;
|
2001-09-10 17:32:22 +00:00
|
|
|
frame_t *frame;
|
2001-08-28 23:05:45 +00:00
|
|
|
player_info_t *info;
|
2001-09-10 17:32:22 +00:00
|
|
|
player_state_t exact;
|
2001-02-19 21:15:25 +00:00
|
|
|
player_state_t *state;
|
2002-07-27 00:44:54 +00:00
|
|
|
qboolean clientplayer;
|
2001-09-10 17:32:22 +00:00
|
|
|
vec3_t org;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
playertime = realtime - cls.latency + 0.02;
|
|
|
|
if (playertime > realtime)
|
|
|
|
playertime = realtime;
|
|
|
|
|
|
|
|
frame = &cl.frames[cl.parsecount & UPDATE_MASK];
|
|
|
|
|
|
|
|
for (j = 0, info = cl.players, state = frame->playerstate; j < MAX_CLIENTS;
|
|
|
|
j++, info++, state++) {
|
2002-04-25 04:30:03 +00:00
|
|
|
ent = &cl_player_ents[j];
|
|
|
|
if (ent->efrag)
|
|
|
|
R_RemoveEfrags (ent);
|
2001-02-19 21:15:25 +00:00
|
|
|
if (state->messagenum != cl.parsecount)
|
2002-07-03 00:37:28 +00:00
|
|
|
continue; // not present this frame
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2002-03-15 16:49:40 +00:00
|
|
|
if (!info->name[0])
|
|
|
|
continue;
|
|
|
|
|
2002-06-18 21:41:24 +00:00
|
|
|
// spawn light flashes, even ones coming from invisible objects
|
|
|
|
if (j == cl.playernum) {
|
|
|
|
VectorCopy (cl.simorg, org);
|
|
|
|
r_player_entity = &cl_player_ents[j];
|
2002-07-27 00:44:54 +00:00
|
|
|
clientplayer = true;
|
|
|
|
} else {
|
2005-04-30 03:59:23 +00:00
|
|
|
VectorCopy (state->pls.origin, org);
|
2002-07-27 00:44:54 +00:00
|
|
|
clientplayer = false;
|
|
|
|
}
|
2005-04-30 03:59:23 +00:00
|
|
|
CL_NewDlight (j + 1, org, state->pls.effects, state->pls.glow_size,
|
|
|
|
state->pls.glow_color);
|
2002-06-18 21:41:24 +00:00
|
|
|
|
2002-07-27 00:44:54 +00:00
|
|
|
// Draw player?
|
|
|
|
if (!Cam_DrawPlayer (j))
|
|
|
|
continue;
|
2002-07-03 00:37:28 +00:00
|
|
|
|
2005-04-30 03:59:23 +00:00
|
|
|
if (!state->pls.modelindex)
|
2001-02-19 21:15:25 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
// Hack hack hack
|
2005-04-30 03:59:23 +00:00
|
|
|
if (cl_deadbodyfilter->int_val
|
|
|
|
&& state->pls.modelindex == cl_playerindex
|
|
|
|
&& ((i = state->pls.frame) == 49 || i == 60 || i == 69 || i == 84
|
2001-02-19 21:15:25 +00:00
|
|
|
|| i == 93 || i == 102))
|
|
|
|
continue;
|
|
|
|
|
2010-01-13 06:42:26 +00:00
|
|
|
// predict only half the move to minimize overruns
|
2002-06-07 11:25:47 +00:00
|
|
|
msec = 500 * (playertime - state->state_time);
|
2002-10-02 21:56:45 +00:00
|
|
|
if (msec <= 0 || (!cl_predict_players->int_val) || cls.demoplayback2) {
|
2005-04-30 03:59:23 +00:00
|
|
|
VectorCopy (state->pls.origin, ent->origin);
|
2002-06-30 16:19:37 +00:00
|
|
|
} else { // predict players movement
|
2005-04-30 03:59:23 +00:00
|
|
|
state->pls.cmd.msec = msec = min (msec, 255);
|
2002-06-07 11:25:47 +00:00
|
|
|
|
|
|
|
oldphysent = pmove.numphysent;
|
|
|
|
CL_SetSolidPlayers (j);
|
2005-04-30 03:59:23 +00:00
|
|
|
CL_PredictUsercmd (state, &exact, &state->pls.cmd, clientplayer);
|
2002-06-07 11:25:47 +00:00
|
|
|
pmove.numphysent = oldphysent;
|
2005-04-30 03:59:23 +00:00
|
|
|
VectorCopy (exact.pls.origin, ent->origin);
|
2002-06-07 11:25:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// angles
|
|
|
|
if (j == cl.playernum)
|
|
|
|
{
|
2002-06-30 16:19:37 +00:00
|
|
|
ent->angles[PITCH] = -cl.viewangles[PITCH] / 3.0;
|
2002-06-07 11:25:47 +00:00
|
|
|
ent->angles[YAW] = cl.viewangles[YAW];
|
2002-06-18 21:41:24 +00:00
|
|
|
} else {
|
2002-06-30 16:19:37 +00:00
|
|
|
ent->angles[PITCH] = -state->viewangles[PITCH] / 3.0;
|
2002-06-07 11:25:47 +00:00
|
|
|
ent->angles[YAW] = state->viewangles[YAW];
|
|
|
|
}
|
2005-04-30 03:59:23 +00:00
|
|
|
ent->angles[ROLL] = V_CalcRoll (ent->angles,
|
|
|
|
state->pls.velocity) * 4.0;
|
2002-06-07 11:25:47 +00:00
|
|
|
|
2005-04-30 03:59:23 +00:00
|
|
|
ent->model = cl.model_precache[state->pls.modelindex];
|
|
|
|
ent->frame = state->pls.frame;
|
2001-12-03 05:36:39 +00:00
|
|
|
ent->colormap = info->translations;
|
2005-04-30 03:59:23 +00:00
|
|
|
ent->skinnum = state->pls.skinnum;
|
2004-07-11 01:41:01 +00:00
|
|
|
|
|
|
|
ent->min_light = 0;
|
|
|
|
ent->fullbright = 0;
|
|
|
|
|
2005-04-30 03:59:23 +00:00
|
|
|
if (state->pls.modelindex == cl_playerindex) { //XXX
|
2001-12-03 05:36:39 +00:00
|
|
|
// use custom skin
|
|
|
|
if (!info->skin)
|
|
|
|
Skin_Find (info);
|
|
|
|
if (info && info->skin) {
|
|
|
|
ent->skin = Skin_NewTempSkin ();
|
|
|
|
if (ent->skin) {
|
|
|
|
CL_NewTranslation (j, ent->skin);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
ent->skin = NULL;
|
|
|
|
}
|
2004-07-11 01:41:01 +00:00
|
|
|
|
|
|
|
ent->min_light = min (cl.fbskins, cl_fb_players->value);
|
|
|
|
|
|
|
|
if (ent->min_light >= 1.0)
|
|
|
|
ent->fullbright = 1;
|
2001-12-03 05:36:39 +00:00
|
|
|
} else {
|
|
|
|
ent->skin = NULL;
|
|
|
|
}
|
2002-06-19 17:01:31 +00:00
|
|
|
|
2002-06-19 17:32:39 +00:00
|
|
|
// stuff entity in map
|
|
|
|
R_AddEfrags (ent);
|
|
|
|
|
2005-04-30 03:59:23 +00:00
|
|
|
if (state->pls.effects & EF_FLAG1)
|
2001-11-25 06:24:26 +00:00
|
|
|
CL_AddFlagModels (ent, 0, j);
|
2005-04-30 03:59:23 +00:00
|
|
|
else if (state->pls.effects & EF_FLAG2)
|
2001-11-25 06:24:26 +00:00
|
|
|
CL_AddFlagModels (ent, 1, j);
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
CL_SetSolid
|
|
|
|
|
|
|
|
Builds all the pmove physents for the current frame
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
CL_SetSolidEntities (void)
|
|
|
|
{
|
2001-09-10 17:32:22 +00:00
|
|
|
int i;
|
|
|
|
entity_state_t *state;
|
|
|
|
frame_t *frame;
|
|
|
|
packet_entities_t *pak;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
pmove.physents[0].model = cl.worldmodel;
|
2003-09-03 22:17:04 +00:00
|
|
|
VectorZero (pmove.physents[0].origin);
|
2001-02-19 21:15:25 +00:00
|
|
|
pmove.physents[0].info = 0;
|
|
|
|
pmove.numphysent = 1;
|
|
|
|
|
|
|
|
frame = &cl.frames[parsecountmod];
|
|
|
|
pak = &frame->packet_entities;
|
|
|
|
|
|
|
|
for (i = 0; i < pak->num_entities; i++) {
|
|
|
|
state = &pak->entities[i];
|
|
|
|
|
|
|
|
if (!state->modelindex)
|
|
|
|
continue;
|
|
|
|
if (!cl.model_precache[state->modelindex])
|
|
|
|
continue;
|
|
|
|
if (cl.model_precache[state->modelindex]->hulls[1].firstclipnode
|
|
|
|
|| cl.model_precache[state->modelindex]->clipbox) {
|
2001-11-26 01:52:08 +00:00
|
|
|
if (pmove.numphysent == MAX_PHYSENTS) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("WARNING: entity physent overflow, email "
|
2003-07-12 21:50:22 +00:00
|
|
|
"quakeforge-devel@lists.quakeforge.net\n");
|
2001-11-26 01:52:08 +00:00
|
|
|
break;
|
|
|
|
}
|
2001-02-19 21:15:25 +00:00
|
|
|
pmove.physents[pmove.numphysent].model =
|
|
|
|
cl.model_precache[state->modelindex];
|
2001-08-28 23:05:45 +00:00
|
|
|
VectorCopy (state->origin,
|
|
|
|
pmove.physents[pmove.numphysent].origin);
|
2001-02-19 21:15:25 +00:00
|
|
|
pmove.numphysent++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-10-02 21:56:45 +00:00
|
|
|
void
|
|
|
|
CL_ClearPredict (void)
|
|
|
|
{
|
|
|
|
memset (predicted_players, 0, sizeof (predicted_players));
|
|
|
|
//fixangle = 0;
|
|
|
|
}
|
|
|
|
|
2001-02-19 21:15:25 +00:00
|
|
|
/*
|
|
|
|
Calculate the new position of players, without other player clipping
|
|
|
|
|
|
|
|
We do this to set up real player prediction.
|
|
|
|
Players are predicted twice, first without clipping other players,
|
|
|
|
then with clipping against them.
|
|
|
|
This sets up the first phase.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
CL_SetUpPlayerPrediction (qboolean dopred)
|
|
|
|
{
|
2001-09-10 17:32:22 +00:00
|
|
|
double playertime;
|
|
|
|
frame_t *frame;
|
|
|
|
int msec, j;
|
|
|
|
player_state_t exact;
|
2001-08-28 23:05:45 +00:00
|
|
|
player_state_t *state;
|
2001-02-19 21:15:25 +00:00
|
|
|
struct predicted_player *pplayer;
|
|
|
|
|
|
|
|
playertime = realtime - cls.latency + 0.02;
|
|
|
|
if (playertime > realtime)
|
|
|
|
playertime = realtime;
|
|
|
|
|
|
|
|
frame = &cl.frames[cl.parsecount & UPDATE_MASK];
|
|
|
|
|
|
|
|
for (j = 0, pplayer = predicted_players, state = frame->playerstate;
|
|
|
|
j < MAX_CLIENTS; j++, pplayer++, state++) {
|
|
|
|
|
|
|
|
pplayer->active = false;
|
|
|
|
|
|
|
|
if (state->messagenum != cl.parsecount)
|
|
|
|
continue; // not present this frame
|
|
|
|
|
2005-04-30 03:59:23 +00:00
|
|
|
if (!state->pls.modelindex)
|
2001-02-19 21:15:25 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
pplayer->active = true;
|
2005-04-30 03:59:23 +00:00
|
|
|
pplayer->flags = state->pls.flags;
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
// note that the local player is special, since he moves locally
|
|
|
|
// we use his last predicted postition
|
|
|
|
if (j == cl.playernum) {
|
|
|
|
VectorCopy (cl.frames[cls.netchan.outgoing_sequence & UPDATE_MASK].
|
2005-04-30 03:59:23 +00:00
|
|
|
playerstate[cl.playernum].pls.origin, pplayer->origin);
|
2001-02-19 21:15:25 +00:00
|
|
|
} else {
|
2010-01-13 06:42:26 +00:00
|
|
|
// predict only half the move to minimize overruns
|
2001-02-19 21:15:25 +00:00
|
|
|
msec = 500 * (playertime - state->state_time);
|
2001-11-15 19:37:29 +00:00
|
|
|
if (msec <= 0 || !dopred) {
|
2005-04-30 03:59:23 +00:00
|
|
|
VectorCopy (state->pls.origin, pplayer->origin);
|
2010-11-23 05:09:30 +00:00
|
|
|
// Sys_MaskPrintf (SYS_DEV, "nopredict\n");
|
2001-02-19 21:15:25 +00:00
|
|
|
} else {
|
|
|
|
// predict players movement
|
2005-04-30 03:59:23 +00:00
|
|
|
state->pls.cmd.msec = msec = min (msec, 255);
|
2010-11-23 05:09:30 +00:00
|
|
|
// Sys_MaskPrintf (SYS_DEV, "predict: %i\n", msec);
|
2001-02-19 21:15:25 +00:00
|
|
|
|
2005-04-30 03:59:23 +00:00
|
|
|
CL_PredictUsercmd (state, &exact, &state->pls.cmd, false);
|
|
|
|
VectorCopy (exact.pls.origin, pplayer->origin);
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
CL_SetSolid
|
|
|
|
|
|
|
|
Builds all the pmove physents for the current frame
|
2003-03-21 21:25:44 +00:00
|
|
|
Note that CL_SetUpPlayerPrediction () must be called first!
|
2001-02-19 21:15:25 +00:00
|
|
|
pmove must be setup with world and solid entity hulls before calling
|
|
|
|
(via CL_PredictMove)
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
CL_SetSolidPlayers (int playernum)
|
|
|
|
{
|
2001-09-10 17:32:22 +00:00
|
|
|
int j;
|
|
|
|
physent_t *pent;
|
2001-02-19 21:15:25 +00:00
|
|
|
struct predicted_player *pplayer;
|
2001-08-28 23:05:45 +00:00
|
|
|
|
2001-02-19 21:15:25 +00:00
|
|
|
if (!cl_solid_players->int_val)
|
|
|
|
return;
|
|
|
|
|
|
|
|
pent = pmove.physents + pmove.numphysent;
|
|
|
|
|
|
|
|
for (j = 0, pplayer = predicted_players; j < MAX_CLIENTS; j++, pplayer++) {
|
|
|
|
if (!pplayer->active)
|
|
|
|
continue; // not present this frame
|
|
|
|
|
|
|
|
// the player object never gets added
|
|
|
|
if (j == playernum)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (pplayer->flags & PF_DEAD)
|
|
|
|
continue; // dead players aren't solid
|
|
|
|
|
2001-11-26 01:52:08 +00:00
|
|
|
if (pmove.numphysent == MAX_PHYSENTS) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("WARNING: player physent overflow, email "
|
2003-07-12 21:50:22 +00:00
|
|
|
"quakeforge-devel@lists.quakeforge.net\n");
|
2001-11-26 01:52:08 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2001-02-19 21:15:25 +00:00
|
|
|
pent->model = 0;
|
|
|
|
VectorCopy (pplayer->origin, pent->origin);
|
|
|
|
VectorCopy (player_mins, pent->mins);
|
|
|
|
VectorCopy (player_maxs, pent->maxs);
|
|
|
|
pmove.numphysent++;
|
|
|
|
pent++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
CL_EmitEntities
|
|
|
|
|
|
|
|
Builds the visedicts array for cl.time
|
|
|
|
|
|
|
|
Made up of: clients, packet_entities, nails, and tents
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
CL_EmitEntities (void)
|
|
|
|
{
|
|
|
|
if (cls.state != ca_active)
|
|
|
|
return;
|
|
|
|
if (!cl.validsequence)
|
|
|
|
return;
|
|
|
|
|
2001-05-20 02:39:56 +00:00
|
|
|
R_ClearEnts ();
|
2001-12-03 05:36:39 +00:00
|
|
|
Skin_ClearTempSkins ();
|
2001-02-19 21:15:25 +00:00
|
|
|
|
|
|
|
CL_LinkPlayers ();
|
|
|
|
CL_LinkPacketEntities ();
|
|
|
|
CL_UpdateTEnts ();
|
2004-03-23 22:39:17 +00:00
|
|
|
|
|
|
|
if (!r_drawentities->int_val) {
|
|
|
|
dlight_t *dl;
|
|
|
|
location_t *nearloc;
|
|
|
|
vec3_t trueloc;
|
2007-09-15 04:20:45 +00:00
|
|
|
int i;
|
2004-03-23 22:39:17 +00:00
|
|
|
|
|
|
|
nearloc = locs_find (r_origin);
|
|
|
|
if (nearloc) {
|
|
|
|
dl = R_AllocDlight (4096);
|
|
|
|
if (dl) {
|
|
|
|
VectorCopy (nearloc->loc, dl->origin);
|
|
|
|
dl->radius = 200;
|
|
|
|
dl->die = r_realtime + 0.1;
|
|
|
|
dl->color[0] = 0;
|
|
|
|
dl->color[1] = 1;
|
|
|
|
dl->color[2] = 0;
|
2004-05-03 06:21:39 +00:00
|
|
|
dl->color[3] = 0.7;
|
2004-03-23 22:39:17 +00:00
|
|
|
}
|
|
|
|
VectorCopy (nearloc->loc, trueloc);
|
2007-09-15 04:20:45 +00:00
|
|
|
R_Particle_New (pt_smokecloud, part_tex_smoke, trueloc, 2.0,
|
|
|
|
vec3_origin, r_realtime + 9.0, 254,
|
|
|
|
0.25 + qfrandom (0.125), 0.0);
|
|
|
|
for (i = 0; i < 15; i++)
|
|
|
|
R_Particle_NewRandom (pt_fallfade, part_tex_dot, trueloc, 12,
|
|
|
|
0.7, 96, r_realtime + 5.0,
|
|
|
|
104 + (rand () & 7), 1.0, 0.0);
|
2004-03-23 22:39:17 +00:00
|
|
|
}
|
|
|
|
}
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CL_Ents_Init (void)
|
|
|
|
{
|
2005-04-25 01:28:37 +00:00
|
|
|
r_view_model = &cl.viewent;
|
2001-02-19 21:15:25 +00:00
|
|
|
}
|