Esempio n. 1
0
void Parse_Damage(void){
	MSG_ReadByte();			//armor
	MSG_ReadByte();			//blood
	MSG_ReadCoord();		//coords
	MSG_ReadCoord();
	MSG_ReadCoord();
}
Esempio n. 2
0
/*
==================
CL_ParseDelta

Can go from either a baseline or a previous packet_entity
==================
*/
static void
CL_ParseDelta(entity_state_t *from, entity_state_t *to, int bits)
{
    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();
	bits |= i;
    }
    to->flags = bits;

    if (bits & U_MODEL)
	to->modelindex = MSG_ReadByte();

    if (bits & U_FRAME)
	to->frame = MSG_ReadByte();

    if (bits & U_COLORMAP)
	to->colormap = MSG_ReadByte();

    if (bits & U_SKIN)
	to->skinnum = MSG_ReadByte();

    if (bits & U_EFFECTS)
	to->effects = MSG_ReadByte();

    if (bits & U_ORIGIN1)
	to->origin[0] = MSG_ReadCoord();

    if (bits & U_ANGLE1)
	to->angles[0] = MSG_ReadAngle();

    if (bits & U_ORIGIN2)
	to->origin[1] = MSG_ReadCoord();

    if (bits & U_ANGLE2)
	to->angles[1] = MSG_ReadAngle();

    if (bits & U_ORIGIN3)
	to->origin[2] = MSG_ReadCoord();

    if (bits & U_ANGLE3)
	to->angles[2] = MSG_ReadAngle();

    if (bits & U_SOLID) {
	// FIXME
    }
}
void Sky_ReadCameraPosition(void)
{
	MathVector3f_t campos;

	sky_camera = MSG_ReadByte();
	if (!sky_camera)
		return;

	campos[0] = MSG_ReadCoord();
	campos[1] = MSG_ReadCoord();
	campos[2] = MSG_ReadCoord();
	Math_VectorCopy(campos, sky_camerapos);
}
Esempio n. 4
0
void Parse_Static(void){
	MSG_ReadByte();
	MSG_ReadByte();
	MSG_ReadByte();
	MSG_ReadByte();
	MSG_ReadCoord();
	MSG_ReadAngle();
	MSG_ReadCoord();
	MSG_ReadAngle();
	MSG_ReadCoord();
	MSG_ReadAngle();


}
Esempio n. 5
0
void Parse_Sound(void){
	int channel;
				
				channel = MSG_ReadShort();
				if (channel & SND_VOLUME)
					MSG_ReadByte();
				if (channel & SND_ATTENUATION)
					MSG_ReadByte();
				MSG_ReadByte();
				MSG_ReadCoord();
				MSG_ReadCoord();
				MSG_ReadCoord();

}
Esempio n. 6
0
/*
=======================
CL_ParticleExplosion (Hexen II)
=======================
*/
void CL_ParticleExplosion(void)
{
	vec3_t org;
	short color, radius, counter;

	org[0] = MSG_ReadCoord();
	org[1] = MSG_ReadCoord();
	org[2] = MSG_ReadCoord();
	color = MSG_ReadShort();
	radius = MSG_ReadShort();
	counter = MSG_ReadShort();

	R_ColoredParticleExplosion(org,color,radius,counter);
}
Esempio n. 7
0
void R_ParseExtendedEmitter (void)
{
	vec3_t		org, vel;
	int			i, count;
	char		*name;
	ParticleEffect_t *eff;
	ParticleEmitter_t *emt;
	float		lifetime, tick;

	//Con_Printf("Particle effect22!!\n");
	//origin to spawn on
	for (i=0 ; i<3 ; i++)
		org[i] = MSG_ReadCoord ();

	//velocity to spawn on
	for (i=0 ; i<3 ; i++)
		vel[i] = MSG_ReadCoord ();

	//number of particles to spawn
	count = MSG_ReadByte ();

	//duration to live
	lifetime = MSG_ReadLong () / 100.0;

	//animation time
	tick = MSG_ReadLong () / 100.0;

	//name of effect to spawn
	name = MSG_ReadString();

	eff = ParticleEffectForName(name);
	if (!eff) return;

	//allocate it
	if (!free_emitters)
		return;
	emt = free_emitters;
	free_emitters = emt->next;
	emt->next = active_emitters;
	active_emitters = emt;

	emt->effect = eff;
	VectorCopy(org,emt->origin);
	VectorCopy(vel,emt->vel);
	emt->die = cl.time+lifetime;
	emt->tick = tick;
	emt->count = count;
	emt->nexttick = 0;
}
Esempio n. 8
0
void Parse_Spawnbaseline(void){
	MSG_ReadShort();
	MSG_ReadByte();
	MSG_ReadByte();
	MSG_ReadByte();
	MSG_ReadByte();
	MSG_ReadCoord();
	MSG_ReadAngle();
	MSG_ReadCoord();
	MSG_ReadAngle();
	MSG_ReadCoord();
	MSG_ReadAngle();


}
Esempio n. 9
0
/*
===============
V_ParseDamage
===============
*/
void
V_ParseDamage(void)
{
    int armor, blood;
    vec3_t from;
    int i;
    vec3_t forward, right, up;
    const entity_t *ent;
    float side;
    float count;

    armor = MSG_ReadByte();
    blood = MSG_ReadByte();
    for (i = 0; i < 3; i++)
	from[i] = MSG_ReadCoord();

    count = blood * 0.5 + armor * 0.5;
    if (count < 10)
	count = 10;

    cl.faceanimtime = cl.time + 0.2;	// but sbar face into pain frame

    cl.cshifts[CSHIFT_DAMAGE].percent += 3 * count;
    if (cl.cshifts[CSHIFT_DAMAGE].percent < 0)
	cl.cshifts[CSHIFT_DAMAGE].percent = 0;
    if (cl.cshifts[CSHIFT_DAMAGE].percent > 150)
	cl.cshifts[CSHIFT_DAMAGE].percent = 150;

    if (armor > blood) {
	cl.cshifts[CSHIFT_DAMAGE].destcolor[0] = 200;
	cl.cshifts[CSHIFT_DAMAGE].destcolor[1] = 100;
	cl.cshifts[CSHIFT_DAMAGE].destcolor[2] = 100;
    } else if (armor) {
	cl.cshifts[CSHIFT_DAMAGE].destcolor[0] = 220;
	cl.cshifts[CSHIFT_DAMAGE].destcolor[1] = 50;
	cl.cshifts[CSHIFT_DAMAGE].destcolor[2] = 50;
    } else {
	cl.cshifts[CSHIFT_DAMAGE].destcolor[0] = 255;
	cl.cshifts[CSHIFT_DAMAGE].destcolor[1] = 0;
	cl.cshifts[CSHIFT_DAMAGE].destcolor[2] = 0;
    }

//
// calculate view angle kicks
//
    ent = &cl_entities[cl.viewentity];

    VectorSubtract(from, ent->origin, from);
    VectorNormalize(from);

    AngleVectors(ent->angles, forward, right, up);

    side = DotProduct(from, right);
    v_dmg_roll = count * side * v_kickroll.value;

    side = DotProduct(from, forward);
    v_dmg_pitch = count * side * v_kickpitch.value;

    v_dmg_time = v_kicktime.value;
}
Esempio n. 10
0
/*
===============
R_ParseBasicEmitter

Parse an emitter out of the server message
Basic emitters don't actually spawn an emitter...
===============
*/
void R_ParseBasicEmitter (void)
{
	vec3_t		org;
	int			i, count;
	char		*name;
	ParticleEffect_t *eff;
	particle_t		*p;

	//Con_Printf("Particle effect!!\n");
	//origin to spawn on
	for (i=0 ; i<3 ; i++)
		org[i] = MSG_ReadCoord ();

	//number of particles to spawn
	count = MSG_ReadByte ();

	//name of effect to spawn
	name = MSG_ReadString();

	eff = ParticleEffectForName(name);
	if (!eff) return;

	for (i=0; i<count; i++) {
		p = InitParticleFromEffect(eff,org);
	}
}
Esempio n. 11
0
/*
===============
R_ParseParticleEffect

Parse an effect out of the server message
===============
*/
void R_ParseParticleEffect(void)
{
	vec3_t		org, dir;
	int			i, count, msgcount, color;

	for (i=0 ; i<3 ; i++)
	{
		org[i] = MSG_ReadCoord();
	}
	for (i=0 ; i<3 ; i++)
	{
		dir[i] = MSG_ReadChar() * (1.0/16);
	}
	msgcount = MSG_ReadByte();
	color = MSG_ReadByte();

	if (msgcount == 255)
	{
		count = 1024;
	}
	else
	{
		count = msgcount;
	}

	R_RunParticleEffect(org, dir, color, count);
}
Esempio n. 12
0
void V_ParseDamage (void)
{
	int armor, blood, i;
	vec3_t from, forward, right;
	float side, count, fraction;

	armor = MSG_ReadByte ();
	blood = MSG_ReadByte ();
	for (i = 0; i < 3; i++)
		from[i] = MSG_ReadCoord ();

	if (cls.demoseeking)
		return;

	count = blood * 0.5 + armor * 0.5;
	if (count < 10)
		count = 10;

	cl.faceanimtime = cl.time + 0.2;		// put sbar face into pain frame

	cl.hurtblur = cl.time + count / 24;		// use hurt motion blur.

	cl.cshifts[CSHIFT_DAMAGE].percent += 3*count;
	if (cl.cshifts[CSHIFT_DAMAGE].percent < 0)
		cl.cshifts[CSHIFT_DAMAGE].percent = 0;
	if (cl.cshifts[CSHIFT_DAMAGE].percent > 150)
		cl.cshifts[CSHIFT_DAMAGE].percent = 150;

	fraction = v_damagecshift.value;
	if (fraction < 0) fraction = 0;
	if (fraction > 1) fraction = 1;
	cl.cshifts[CSHIFT_DAMAGE].percent *= fraction;

	if (armor > blood) {
		cl.cshifts[CSHIFT_DAMAGE].destcolor[0] = 200;
		cl.cshifts[CSHIFT_DAMAGE].destcolor[1] = cl.cshifts[CSHIFT_DAMAGE].destcolor[2] = 100;
	} else if (armor) {
		cl.cshifts[CSHIFT_DAMAGE].destcolor[0] = 220;
		cl.cshifts[CSHIFT_DAMAGE].destcolor[1] = cl.cshifts[CSHIFT_DAMAGE].destcolor[2] = 50;
	} else {
		cl.cshifts[CSHIFT_DAMAGE].destcolor[0] = 255;
		cl.cshifts[CSHIFT_DAMAGE].destcolor[1] = cl.cshifts[CSHIFT_DAMAGE].destcolor[2] = 0;
	}

	// calculate view angle kicks
	VectorSubtract (from, cl.simorg, from);
	VectorNormalizeFast (from);

	AngleVectors (cl.simangles, forward, right, NULL);

	side = DotProduct (from, right);
	v_dmg_roll = count * side * v_kickroll.value;

	side = DotProduct (from, forward);
	v_dmg_pitch = count * side * v_kickpitch.value;

	v_dmg_time = v_kicktime.value;
}
Esempio n. 13
0
/*
==================
CL_ParseBSPDecal

Spawn decals on map
Crow_bar.
================== 
*/
void CL_ParseBSPDecal (void)
{
	vec3_t		pos;
	int			decal_size;
	char        *texname;

    texname     = MSG_ReadString ();
    decal_size  = MSG_ReadByte   ();
	pos[0]      = MSG_ReadCoord  ();
    pos[1]      = MSG_ReadCoord  ();
    pos[2]      = MSG_ReadCoord  ();

	if(!texname)
		return;

	Con_Printf("BSPDECAL[tex: %s size: %i pos: %f %f %f]\n", texname, decal_size, pos[0], pos[1], pos[2]);

	R_SpawnDecalBSP(pos, texname, decal_size);
}
Esempio n. 14
0
/*
==================
CL_ParseStartSoundPacket
==================
*/
void CL_ParseStartSoundPacket(void)
{
	vec3_t	pos;
	int	channel, ent;
	int	sound_num;
	int	volume;
	int	field_mask;
	float	attenuation;
	int	i;

	field_mask = MSG_ReadByte();

	if (field_mask & SND_VOLUME)
		volume = MSG_ReadByte ();
	else
		volume = DEFAULT_SOUND_PACKET_VOLUME;

	if (field_mask & SND_ATTENUATION)
		attenuation = MSG_ReadByte () / 64.0;
	else
		attenuation = DEFAULT_SOUND_PACKET_ATTENUATION;

	//johnfitz -- PROTOCOL_FITZQUAKE
	if (field_mask & SND_LARGEENTITY)
	{
		ent = (unsigned short) MSG_ReadShort ();
		channel = MSG_ReadByte ();
	}
	else
	{
		channel = (unsigned short) MSG_ReadShort ();
		ent = channel >> 3;
		channel &= 7;
	}

	if (field_mask & SND_LARGESOUND)
		sound_num = (unsigned short) MSG_ReadShort ();
	else
		sound_num = MSG_ReadByte ();
	//johnfitz

	//johnfitz -- check soundnum
	if (sound_num >= MAX_SOUNDS)
		Host_Error ("CL_ParseStartSoundPacket: %i > MAX_SOUNDS", sound_num);
	//johnfitz

	if (ent > cl_max_edicts) //johnfitz -- no more MAX_EDICTS
		Host_Error ("CL_ParseStartSoundPacket: ent = %i", ent);

	for (i = 0; i < 3; i++)
		pos[i] = MSG_ReadCoord ();

	S_StartSound (ent, channel, cl.sound_precache[sound_num], pos, volume/255.0, attenuation);
}
Esempio n. 15
0
/*
=================
CL_ParseBeam
=================
*/
void CL_ParseBeam (const char *modelname, qboolean parse_only)
{
	int		i, ent, index;
	vec3_t	start, end;
	beam_t	*b;
	
	ent = MSG_ReadShort ();
	
	start[0] = MSG_ReadCoord ();
	start[1] = MSG_ReadCoord ();
	start[2] = MSG_ReadCoord ();
	
	end[0] = MSG_ReadCoord ();
	end[1] = MSG_ReadCoord ();
	end[2] = MSG_ReadCoord ();

	if (parse_only)
		return;		// JDH: parse message only, don't do anything
	
	
	if (ent == cl.viewentity)
		VectorCopy (end, playerbeam_end);	// for cl_truelightning

	index = MAX_BEAMS;

	for (i = 0, b = cl_beams ; i < MAX_BEAMS ; i++, b++)
	{
		// override any beam with the same entity
		if (b->entity == ent)
		{
			index = i;
			break;
		}
		
		// make note of first available slot, but continue checking for same ent:
//		if ((index == MAX_BEAMS) && (!b->model || (b->endtime < cl.time)))
		if ((index == MAX_BEAMS) && (!b->model || BEAM_INACTIVE(b)))
		{
			index = i;
		}
	}

	if (index < MAX_BEAMS)
	{
		b = cl_beams + index;
		b->entity = ent;
		b->model = Mod_ForName (modelname, true);
		b->starttime = cl.time - 0.2;			// JDH: for demo rewind (see note in AllocParticle)
		b->endtime = cl.time + 0.2;
		VectorCopy (start, b->start);
		VectorCopy (end, b->end);
#ifdef _DEBUG
//		if (cls.demoplayback && !cl_demorewind.value)
//			CL_PushBeam (b);
#endif
		return;	
	}

	Con_Print ("beam list overflow!\n");	
}
Esempio n. 16
0
void CL_ParseStaticSound (void)
{
	vec3_t		org;
	int			sound_num, vol, atten;
	int			i;
	
	for (i=0 ; i<3 ; i++)
		org[i] = MSG_ReadCoord ();
	sound_num = MSG_ReadByte ();
	vol = MSG_ReadByte ();
	atten = MSG_ReadByte ();
	
	S_StaticSound (cl.sound_precache[sound_num], org, vol, atten);
}
Esempio n. 17
0
void CL_ParseBaseline (entity_t *ent)
{
	int			i;
	
	ent->baseline.modelindex = MSG_ReadByte ();
	ent->baseline.frame = MSG_ReadByte ();
	ent->baseline.colormap = MSG_ReadByte();
	ent->baseline.skin = MSG_ReadByte();
	for (i=0 ; i<3 ; i++)
	{
		ent->baseline.origin[i] = MSG_ReadCoord ();
		ent->baseline.angles[i] = MSG_ReadAngle ();
	}
}
Esempio n. 18
0
/*
===============
R_ParseParticleEffect4

Parse an effect out of the server message
===============
*/
void R_ParseParticleEffect4 (void)
{
	vec3_t		org;
	int			i, msgcount, color, effect;
	float		radius;
	
	for (i=0 ; i<3 ; i++)
		org[i] = MSG_ReadCoord ();
	radius = MSG_ReadByte();
	color = MSG_ReadShort ();
	msgcount = MSG_ReadByte ();
	effect = particle_remap[ MSG_ReadByte() ];

	R_RunParticleEffect4 (org, radius, color, effect, msgcount);
}
Esempio n. 19
0
/*
===============
R_ParseParticleEffect3

Parse an effect out of the server message
===============
*/
void R_ParseParticleEffect3 (void)
{
	vec3_t		org, box;
	int			i, msgcount, color, effect;
	
	for (i=0 ; i<3 ; i++)
		org[i] = MSG_ReadCoord ();
	for (i=0 ; i<3 ; i++)
		box[i] = MSG_ReadByte ();
	color = MSG_ReadShort ();
	msgcount = MSG_ReadByte ();
	effect = particle_remap[ MSG_ReadByte() ];

	R_RunParticleEffect3 (org, box, color, effect, msgcount);
}
Esempio n. 20
0
/*
==================
CL_ParseStartSoundPacket
==================
*/
static void CL_ParseStartSoundPacket(void)
{
	vec3_t	pos;
	int		channel, ent;
	int		sound_num, volume, field_mask;
	float	attenuation;
	int		i;

	field_mask = MSG_ReadByte();

	if (field_mask & SND_VOLUME)
		volume = MSG_ReadByte ();
	else
		volume = DEFAULT_SOUND_PACKET_VOLUME;

	if (field_mask & SND_ATTENUATION)
		attenuation = MSG_ReadByte () / 64.0;
	else
		attenuation = DEFAULT_SOUND_PACKET_ATTENUATION;

	channel = MSG_ReadShort ();
	sound_num = MSG_ReadByte ();
	if (field_mask & SND_OVERFLOW)
		sound_num += MAX_SOUNDS_OLD;
	if (field_mask & SND_OVERFLOW2)
	{
	/* this means the server has MAX_SOUNDS > 512 (== 1024)
	 * and is sending it to us as a byte: Kor Skarn's code.
	 * UQE does this but I haven't seen this in real life yet.
	 * Currently not supported.  TODO: in a newer protocol.
	 */
		sound_num += MAX_SOUNDS_H2MP;	/* +512  */
		Con_DPrintf("%s: field_mask & SND_OVERFLOW2 (%d)\n", __thisfunc__, sound_num);
		return;
	}

	ent = channel >> 3;
	channel &= 7;

	if (ent > MAX_EDICTS)
		Host_Error ("%s: ent = %i", __thisfunc__, ent);

	for (i = 0; i < 3; i++)
		pos[i] = MSG_ReadCoord ();

	S_StartSound (ent, channel, cl.sound_precache[sound_num], pos, volume/255.0, attenuation);
}
Esempio n. 21
0
/*
==================
CL_ParseBaseline
==================
*/
static void CL_ParseBaseline (entity_t *ent)
{
	int			i;

	ent->baseline.modelindex = MSG_ReadShort ();
	ent->baseline.frame = MSG_ReadByte ();
	ent->baseline.colormap = MSG_ReadByte();
	ent->baseline.skin = MSG_ReadByte();
	ent->baseline.scale = MSG_ReadByte();
	ent->baseline.drawflags = MSG_ReadByte();
	ent->baseline.abslight = MSG_ReadByte();
	for (i = 0; i < 3; i++)
	{
		ent->baseline.origin[i] = MSG_ReadCoord ();
		ent->baseline.angles[i] = MSG_ReadAngle ();
	}
}
Esempio n. 22
0
/*
===============
R_ParseParticleEffect2

Parse an effect out of the server message
===============
*/
void R_ParseParticleEffect2 (void)
{
	vec3_t		org, dmin, dmax;
	int			i, msgcount, color, effect;
	
	for (i=0 ; i<3 ; i++)
		org[i] = MSG_ReadCoord ();
	for (i=0 ; i<3 ; i++)
		dmin[i] = MSG_ReadFloat ();
	for (i=0 ; i<3 ; i++)
		dmax[i] = MSG_ReadFloat ();
	color = MSG_ReadShort ();
	msgcount = MSG_ReadByte ();
	effect = MSG_ReadByte ();

	R_RunParticleEffect2 (org, dmin, dmax, color, effect, msgcount);
}
Esempio n. 23
0
/*
===================
CL_ParseStaticSound
===================
*/
static void CL_ParseStaticSound (void)
{
	vec3_t		org;
	int			sound_num, vol, atten;
	int			i;

	for (i = 0; i < 3; i++)
		org[i] = MSG_ReadCoord ();

	if (cl_protocol == PROTOCOL_RAVEN_111)
		sound_num = MSG_ReadByte ();
	else
		sound_num = MSG_ReadShort();
	vol = MSG_ReadByte ();
	atten = MSG_ReadByte ();

	S_StaticSound (cl.sound_precache[sound_num], org, vol, atten);
}
Esempio n. 24
0
/*
==================
CL_ParseBaseline
==================
*/
static void
CL_ParseBaseline(entity_t *ent, unsigned int bits)
{
    int i;

    ent->baseline.modelindex = CL_ReadModelIndex(bits);
    ent->baseline.frame = CL_ReadModelFrame(bits);
    ent->baseline.colormap = MSG_ReadByte();
    ent->baseline.skinnum = MSG_ReadByte();
    for (i = 0; i < 3; i++) {
	ent->baseline.origin[i] = MSG_ReadCoord();
	ent->baseline.angles[i] = MSG_ReadAngle();
    }

    if (cl.protocol == PROTOCOL_VERSION_FITZ && (bits & B_FITZ_ALPHA)) {
	MSG_ReadByte(); // FIXME - TODO
    }
}
Esempio n. 25
0
/*
=================
CL_ParseBeam
=================
*/
void CL_ParseBeam (qmodel_t *m)
{
	int		ent;
	vec3_t	start, end;
	beam_t	*b;
	int		i;

	ent = MSG_ReadShort ();

	start[0] = MSG_ReadCoord ();
	start[1] = MSG_ReadCoord ();
	start[2] = MSG_ReadCoord ();

	end[0] = MSG_ReadCoord ();
	end[1] = MSG_ReadCoord ();
	end[2] = MSG_ReadCoord ();

// override any beam with the same entity
	for (i=0, b=cl_beams ; i< MAX_BEAMS ; i++, b++)
		if (b->entity == ent)
		{
			b->entity = ent;
			b->model = m;
			b->endtime = cl.time + 0.2;
			VectorCopy (start, b->start);
			VectorCopy (end, b->end);
			return;
		}

// find a free beam
	for (i=0, b=cl_beams ; i< MAX_BEAMS ; i++, b++)
	{
		if (!b->model || b->endtime < cl.time)
		{
			b->entity = ent;
			b->model = m;
			b->endtime = cl.time + 0.2;
			VectorCopy (start, b->start);
			VectorCopy (end, b->end);
			return;
		}
	}

	//johnfitz -- less spammy overflow message
	if (!dev_overflows.beams || dev_overflows.beams + CONSOLE_RESPAM_TIME < realtime )
	{
		Con_Printf ("Beam list overflow!\n");
		dev_overflows.beams = realtime;
	}
	//johnfitz
}
Esempio n. 26
0
/*
===============
R_ParseParticleEffect

Parse an effect out of the server message
===============
*/
void R_ParseParticleEffect (void)
{
	vec3_t		org, dir;
	int			i, count, msgcount, color;
	
	for (i=0 ; i<3 ; i++)
		org[i] = MSG_ReadCoord (net_message, cl.protocolflags);
	for (i=0 ; i<3 ; i++)
		dir[i] = MSG_ReadChar (net_message) * (1.0/16);
	msgcount = MSG_ReadByte (net_message);
	color = MSG_ReadByte (net_message);

	if (msgcount == 255)
		count = 1024;
	else
		count = msgcount;

	R_RunParticleEffect (org, dir, color, count);
}
Esempio n. 27
0
/*
==================
CL_ParseStartSoundPacket
==================
*/
void
CL_ParseStartSoundPacket(void)
{
    vec3_t pos;
    int channel, ent;
    int sound_num;
    int volume;
    int field_mask;
    float attenuation;
    int i;

    field_mask = MSG_ReadByte();

    if (field_mask & SND_VOLUME)
	volume = MSG_ReadByte();
    else
	volume = DEFAULT_SOUND_PACKET_VOLUME;

    if (field_mask & SND_ATTENUATION)
	attenuation = MSG_ReadByte() / 64.0;
    else
	attenuation = DEFAULT_SOUND_PACKET_ATTENUATION;

    if (cl.protocol == PROTOCOL_VERSION_FITZ && (field_mask & SND_FITZ_LARGEENTITY)) {
	ent = (unsigned short)MSG_ReadShort();
	channel = MSG_ReadByte();
    } else {
	channel = MSG_ReadShort();
	ent = channel >> 3;
	channel &= 7;
    }
    sound_num = CL_ReadSoundNum(field_mask);

    if (ent > MAX_EDICTS)
	Host_Error("CL_ParseStartSoundPacket: ent = %i", ent);

    for (i = 0; i < 3; i++)
	pos[i] = MSG_ReadCoord();

    S_StartSound(ent, channel, cl.sound_precache[sound_num], pos,
		 volume / 255.0, attenuation);
}
/*
=================
CL_ParseBeam
=================
*/
static void CL_ParseBeam (model_t *m)
{
	int	i, ent;
	vec3_t	start, end;
	beam_t	*b;

	ent = MSG_ReadShort ();

	start[0] = MSG_ReadCoord ();
	start[1] = MSG_ReadCoord ();
	start[2] = MSG_ReadCoord ();

	end[0] = MSG_ReadCoord ();
	end[1] = MSG_ReadCoord ();
	end[2] = MSG_ReadCoord ();
#ifdef SUPPORTS_SOFTWARE_FTESTAIN
	R_AddStain(end, 80, 12); //qbism ftestain
#endif

// override any beam with the same entity
	for (i=0, b=cl_beams ; i< MAX_BEAMS ; i++, b++)
	{
		if (b->entity == ent)
		{
			b->entity = ent;
			b->model = m;
			b->endtime = cl.time + 0.2;
			VectorCopy (start, b->start);
			VectorCopy (end, b->end);
			return;
		}
	}

// find a free beam
	for (i=0, b=cl_beams ; i< MAX_BEAMS ; i++, b++)
	{
		if (!b->model || b->endtime < cl.time)
		{
			b->entity = ent;
			b->model = m;
			b->endtime = cl.time + 0.2;
			VectorCopy (start, b->start);
			VectorCopy (end, b->end);
			return;
		}
	}

	Con_Printf ("beam list overflow!\n");
}
Esempio n. 29
0
/*
===================
CL_ParseStaticSound
===================
*/
void CL_ParseStaticSound (int version) //johnfitz -- added argument
{
	vec3_t		org;
	int			sound_num, vol, atten;
	int			i;

	for (i = 0; i < 3; i++)
		org[i] = MSG_ReadCoord ();

	//johnfitz -- PROTOCOL_FITZQUAKE
	if (version == 2)
		sound_num = MSG_ReadShort ();
	else
		sound_num = MSG_ReadByte ();
	//johnfitz

	vol = MSG_ReadByte ();
	atten = MSG_ReadByte ();

	S_StaticSound (cl.sound_precache[sound_num], org, vol, atten);
}
Esempio n. 30
0
/*
=================
CL_ParseBeam
=================
*/
void CL_ParseBeam (model_t *m)
{
	int		ent;
	vec3_t	start, end;
	beam_t	*b;
	int		i;

	ent = MSG_ReadShort ();

	start[0] = MSG_ReadCoord ();
	start[1] = MSG_ReadCoord ();
	start[2] = MSG_ReadCoord ();

	end[0] = MSG_ReadCoord ();
	end[1] = MSG_ReadCoord ();
	end[2] = MSG_ReadCoord ();

// override any beam with the same entity
	for (i=0, b=cl_beams ; i< MAX_BEAMS ; i++, b++)
		if (b->entity == ent)
		{
			b->entity = ent;
			b->model = m;
			b->endtime = cl.time + 0.2;

			VectorCopy (start, b->start);
			VectorCopy (end, b->end);
			return;
		}

// find a free beam
	for (i=0, b=cl_beams ; i< MAX_BEAMS ; i++, b++)
	{
		if (!b->model || b->endtime < cl.time)
		{
			b->entity = ent;
			b->model = m;
			b->endtime = cl.time + 0.2;
			
			VectorCopy (start, b->start);
			VectorCopy (end, b->end);

			
			return;
		}
	}
	Con_Printf ("beam list overflow!\n");
}