Source/ThunderBeast/QuakeToonProto1/client/cl_ents.c
void CL_ParseProjectiles (void)
{
	int		i, c, j;
	byte	bits[8];
	byte	b;
	projectile_t	pr;
	int lastempty = -1;
	qboolean old = false;

	c = MSG_ReadByte (&net_message);
	for (i=0 ; i<c ; i++)
	{
		bits[0] = MSG_ReadByte (&net_message);
		bits[1] = MSG_ReadByte (&net_message);
		bits[2] = MSG_ReadByte (&net_message);
		bits[3] = MSG_ReadByte (&net_message);
		bits[4] = MSG_ReadByte (&net_message);
		pr.origin[0] = ( ( bits[0] + ((bits[1]&15)<<8) ) <<1) - 4096;
		pr.origin[1] = ( ( (bits[1]>>4) + (bits[2]<<4) ) <<1) - 4096;
		pr.origin[2] = ( ( bits[3] + ((bits[4]&15)<<8) ) <<1) - 4096;
		VectorCopy(pr.origin, pr.oldorigin);

		if (bits[4] & 64)
			pr.effects = EF_BLASTER;
		else
			pr.effects = 0;

		if (bits[4] & 128) {
			old = true;
			bits[0] = MSG_ReadByte (&net_message);
			bits[1] = MSG_ReadByte (&net_message);
			bits[2] = MSG_ReadByte (&net_message);
			bits[3] = MSG_ReadByte (&net_message);
			bits[4] = MSG_ReadByte (&net_message);
			pr.oldorigin[0] = ( ( bits[0] + ((bits[1]&15)<<8) ) <<1) - 4096;
			pr.oldorigin[1] = ( ( (bits[1]>>4) + (bits[2]<<4) ) <<1) - 4096;
			pr.oldorigin[2] = ( ( bits[3] + ((bits[4]&15)<<8) ) <<1) - 4096;
		}

		bits[0] = MSG_ReadByte (&net_message);
		bits[1] = MSG_ReadByte (&net_message);
		bits[2] = MSG_ReadByte (&net_message);

		pr.angles[0] = 360*bits[0]/256;
		pr.angles[1] = 360*bits[1]/256;
		pr.modelindex = bits[2];

		b = MSG_ReadByte (&net_message);
		pr.num = (b & 0x7f);
		if (b & 128) // extra entity number byte
			pr.num |= (MSG_ReadByte (&net_message) << 7);

		pr.present = true;

		// find if this projectile already exists from previous frame 
		for (j = 0; j < MAX_PROJECTILES; j++) {
			if (cl_projectiles[j].modelindex) {
				if (cl_projectiles[j].num == pr.num) {
					// already present, set up oldorigin for interpolation
					if (!old)
						VectorCopy(cl_projectiles[j].origin, pr.oldorigin);
					cl_projectiles[j] = pr;
					break;
				}
			} else
				lastempty = j;
		}

		// not present previous frame, add it
		if (j == MAX_PROJECTILES) {
			if (lastempty != -1) {
				cl_projectiles[lastempty] = pr;
			}
		}
	}
}
/*
=====================
CL_ParseProjectiles

Flechettes are passed as efficient temporary entities
=====================
*/
CL_ParseProjectiles
Flechettes are passed as efficient temporary entities
CL_ParseProjectiles Flechettes are passed as efficient temporary entities
void CL_ParseProjectiles (void)
{
	int		i, c, j;
	byte	bits[8];
	byte	b;
	projectile_t	pr;
	int lastempty = -1;
	qboolean old = false;
	c = MSG_ReadByte (&net_message);
	for (i=0 ; i<c ; i++)
	{
		bits[0] = MSG_ReadByte (&net_message);
		bits[1] = MSG_ReadByte (&net_message);
		bits[2] = MSG_ReadByte (&net_message);
		bits[3] = MSG_ReadByte (&net_message);
		bits[4] = MSG_ReadByte (&net_message);
		pr.origin[0] = ( ( bits[0] + ((bits[1]&15)<<8) ) <<1) - 4096;
		pr.origin[1] = ( ( (bits[1]>>4) + (bits[2]<<4) ) <<1) - 4096;
		pr.origin[2] = ( ( bits[3] + ((bits[4]&15)<<8) ) <<1) - 4096;
		VectorCopy(pr.origin, pr.oldorigin);
		if (bits[4] & 64)
			pr.effects = EF_BLASTER;
		else
			pr.effects = 0;
		if (bits[4] & 128) {
			old = true;
			bits[0] = MSG_ReadByte (&net_message);
			bits[1] = MSG_ReadByte (&net_message);
			bits[2] = MSG_ReadByte (&net_message);
			bits[3] = MSG_ReadByte (&net_message);
			bits[4] = MSG_ReadByte (&net_message);
			pr.oldorigin[0] = ( ( bits[0] + ((bits[1]&15)<<8) ) <<1) - 4096;
			pr.oldorigin[1] = ( ( (bits[1]>>4) + (bits[2]<<4) ) <<1) - 4096;
			pr.oldorigin[2] = ( ( bits[3] + ((bits[4]&15)<<8) ) <<1) - 4096;
		}
		bits[0] = MSG_ReadByte (&net_message);
		bits[1] = MSG_ReadByte (&net_message);
		bits[2] = MSG_ReadByte (&net_message);
		pr.angles[0] = 360*bits[0]/256;
		pr.angles[1] = 360*bits[1]/256;
		pr.modelindex = bits[2];
		b = MSG_ReadByte (&net_message);
		pr.num = (b & 0x7f);
		if (b & 128) 
			pr.num |= (MSG_ReadByte (&net_message) << 7);
		pr.present = true;
		for (j = 0; j < MAX_PROJECTILES; j++) {
			if (cl_projectiles[j].modelindex) {
				if (cl_projectiles[j].num == pr.num) {
					if (!old)
						VectorCopy(cl_projectiles[j].origin, pr.oldorigin);
					cl_projectiles[j] = pr;
					break;
				}
			} else
				lastempty = j;
		}
		if (j == MAX_PROJECTILES) {
			if (lastempty != -1) {
				cl_projectiles[lastempty] = pr;
			}
		}
	}
}
void CL_ParseProjectiles ( void ) { int i , c , j ; byte bits [ 8 ] ; byte b ; projectile_t pr ; int lastempty = -1 ; qboolean old = false ; c = MSG_ReadByte ( & net_message ) ; for ( i = 0 ; i < c ; i ++ ) { bits [ 0 ] = MSG_ReadByte ( & net_message ) ; bits [ 1 ] = MSG_ReadByte ( & net_message ) ; bits [ 2 ] = MSG_ReadByte ( & net_message ) ; bits [ 3 ] = MSG_ReadByte ( & net_message ) ; bits [ 4 ] = MSG_ReadByte ( & net_message ) ; pr . origin [ 0 ] = ( ( bits [ 0 ] + ( ( bits [ 1 ] & 15 ) << 8 ) ) << 1 ) - 4096 ; pr . origin [ 1 ] = ( ( ( bits [ 1 ] >> 4 ) + ( bits [ 2 ] << 4 ) ) << 1 ) - 4096 ; pr . origin [ 2 ] = ( ( bits [ 3 ] + ( ( bits [ 4 ] & 15 ) << 8 ) ) << 1 ) - 4096 ; VectorCopy ( pr . origin , pr . oldorigin ) ; if ( bits [ 4 ] & 64 ) pr . effects = EF_BLASTER ; else pr . effects = 0 ; if ( bits [ 4 ] & 128 ) { old = true ; bits [ 0 ] = MSG_ReadByte ( & net_message ) ; bits [ 1 ] = MSG_ReadByte ( & net_message ) ; bits [ 2 ] = MSG_ReadByte ( & net_message ) ; bits [ 3 ] = MSG_ReadByte ( & net_message ) ; bits [ 4 ] = MSG_ReadByte ( & net_message ) ; pr . oldorigin [ 0 ] = ( ( bits [ 0 ] + ( ( bits [ 1 ] & 15 ) << 8 ) ) << 1 ) - 4096 ; pr . oldorigin [ 1 ] = ( ( ( bits [ 1 ] >> 4 ) + ( bits [ 2 ] << 4 ) ) << 1 ) - 4096 ; pr . oldorigin [ 2 ] = ( ( bits [ 3 ] + ( ( bits [ 4 ] & 15 ) << 8 ) ) << 1 ) - 4096 ; } bits [ 0 ] = MSG_ReadByte ( & net_message ) ; bits [ 1 ] = MSG_ReadByte ( & net_message ) ; bits [ 2 ] = MSG_ReadByte ( & net_message ) ; pr . angles [ 0 ] = 360 * bits [ 0 ] / 256 ; pr . angles [ 1 ] = 360 * bits [ 1 ] / 256 ; pr . modelindex = bits [ 2 ] ; b = MSG_ReadByte ( & net_message ) ; pr . num = ( b & 0x7f ) ; if ( b & 128 ) pr . num |= ( MSG_ReadByte ( & net_message ) << 7 ) ; pr . present = true ; for ( j = 0 ; j < MAX_PROJECTILES ; j ++ ) { if ( cl_projectiles [ j ] . modelindex ) { if ( cl_projectiles [ j ] . num == pr . num ) { if ( ! old ) VectorCopy ( cl_projectiles [ j ] . origin , pr . oldorigin ) ; cl_projectiles [ j ] = pr ; break ; } } else lastempty = j ; } if ( j == MAX_PROJECTILES ) { if ( lastempty != -1 ) { cl_projectiles [ lastempty ] = pr ; } } } }
CL_ParseProjectiles
Flechettes are passed as efficient temporary entities
CL_ParseProjectiles Flechettes are passed as efficient temporary entities
// extra entity number byte // find if this projectile already exists from previous frame  // already present, set up oldorigin for interpolation // not present previous frame, add it