// cl_parse.c -- parse a message received from the server
#include "quakedef.h"
+#include "cdaudio.h"
#include "cl_collision.h"
char *svc_strings[128] =
MSG_ReadVector(pos, cl.protocol);
- S_StartSound (ent, channel, cl.sound_precache[sound_num], pos, volume/255.0, attenuation);
+ S_StartSound (ent, channel, cl.sound_precache[sound_num], pos, volume/255.0f, attenuation);
}
/*
for (i = 1;i < nummodels;i++)
{
CL_KeepaliveMessage();
- Mod_TouchModel(parse_model_precache[i]);
+ Mod_FindName(parse_model_precache[i]);
}
Mod_PurgeUnused();
// do the same for sounds
- S_ClearUsed();
- for (i = 1;i < numsounds;i++)
- {
- CL_KeepaliveMessage();
- S_TouchSound(parse_sound_precache[i], true);
- }
- S_PurgeUnused();
+ S_ServerSounds (parse_sound_precache, numsounds);
// now we try to load everything that is new
for (i=1 ; i<numsounds ; i++)
{
CL_KeepaliveMessage();
- cl.sound_precache[i] = S_PrecacheSound(parse_sound_precache[i], true, true);
+
+ // Don't lock the sfx here, S_ServerSounds already did that
+ cl.sound_precache[i] = S_PrecacheSound (parse_sound_precache[i], true, false);
}
// local state
Host_Error("CL_ValidateState: modelindex (%i) >= MAX_MODELS (%i)\n", s->modelindex, MAX_MODELS);
// colormap is client index + 1
- if (s->colormap > cl.maxclients)
+ if ((!s->flags & RENDER_COLORMAPPED) && s->colormap > cl.maxclients)
{
Con_DPrintf("CL_ValidateState: colormap (%i) > cl.maxclients (%i)\n", s->colormap, cl.maxclients);
s->colormap = 0;
model = cl.model_precache[s->modelindex];
Mod_CheckLoaded(model);
- if (model && s->frame >= model->numframes)
+ if (model && model->type && s->frame >= model->numframes)
{
- Con_DPrintf("CL_ValidateState: no such frame %i in \"%s\"\n", s->frame, model->name);
+ Con_DPrintf("CL_ValidateState: no such frame %i in \"%s\" (which has %i frames)\n", s->frame, model->name, model->numframes);
s->frame = 0;
}
- if (model && s->skin > 0 && s->skin >= model->numskins)
+ if (model && model->type && s->skin > 0 && s->skin >= model->numskins && !(s->lightpflags & PFLAGS_FULLDYNAMIC))
{
- Con_DPrintf("CL_ValidateState: no such skin %i in \"%s\"\n", s->skin, model->name);
+ Con_DPrintf("CL_ValidateState: no such skin %i in \"%s\" (which has %i skins)\n", s->skin, model->name, model->numskins);
s->skin = 0;
}
}
CL_ValidateState(&ent->state_current);
VectorSubtract(ent->state_current.origin, ent->persistent.neworigin, odelta);
VectorSubtract(ent->state_current.angles, ent->persistent.newangles, adelta);
- if (!ent->state_previous.active || cls.timedemo || DotProduct(odelta, odelta) > 1000*1000 || cl_nolerp.integer)
+ if (!ent->state_previous.active || ent->state_previous.modelindex != ent->state_current.modelindex)
+ {
+ // reset all persistent stuff if this is a new entity
+ ent->persistent.lerpdeltatime = 0;
+ ent->persistent.lerpstarttime = cl.mtime[1];
+ VectorCopy(ent->state_current.origin, ent->persistent.oldorigin);
+ VectorCopy(ent->state_current.angles, ent->persistent.oldangles);
+ VectorCopy(ent->state_current.origin, ent->persistent.neworigin);
+ VectorCopy(ent->state_current.angles, ent->persistent.newangles);
+ // reset animation interpolation as well
+ ent->render.frame = ent->render.frame1 = ent->render.frame2 = ent->state_current.frame;
+ ent->render.frame1time = ent->render.frame2time = cl.time;
+ ent->render.framelerp = 1;
+ // reset various persistent stuff
+ ent->persistent.muzzleflash = 0;
+ VectorCopy(ent->state_current.origin, ent->persistent.trail_origin);
+ }
+ else if (cls.timedemo || cl_nolerp.integer || DotProduct(odelta, odelta) > 1000*1000)
{
- // we definitely shouldn't lerp
+ // don't interpolate the move
ent->persistent.lerpdeltatime = 0;
ent->persistent.lerpstarttime = cl.mtime[1];
VectorCopy(ent->state_current.origin, ent->persistent.oldorigin);
else
{
// not a monster
- ent->persistent.lerpstarttime = cl.mtime[1];
+ ent->persistent.lerpstarttime = ent->state_previous.time;
// no lerp if it's singleplayer
if (cl.islocalgame)
ent->persistent.lerpdeltatime = 0;
else
- ent->persistent.lerpdeltatime = cl.mtime[0] - cl.mtime[1];
+ ent->persistent.lerpdeltatime = bound(0, ent->state_current.time - ent->state_previous.time, 0.1);
VectorCopy(ent->persistent.neworigin, ent->persistent.oldorigin);
VectorCopy(ent->persistent.newangles, ent->persistent.oldangles);
VectorCopy(ent->state_current.origin, ent->persistent.neworigin);
vol = MSG_ReadByte ();
atten = MSG_ReadByte ();
- S_StaticSound (cl.sound_precache[sound_num], org, vol, atten);
+ S_StaticSound (cl.sound_precache[sound_num], org, vol/255.0f, atten);
}
void CL_ParseEffect (void)
*/
void CL_InitTEnts (void)
{
- cl_sfx_wizhit = S_PrecacheSound ("wizard/hit.wav", false, true);
- cl_sfx_knighthit = S_PrecacheSound ("hknight/hit.wav", false, true);
- cl_sfx_tink1 = S_PrecacheSound ("weapons/tink1.wav", false, true);
- cl_sfx_ric1 = S_PrecacheSound ("weapons/ric1.wav", false, true);
- cl_sfx_ric2 = S_PrecacheSound ("weapons/ric2.wav", false, true);
- cl_sfx_ric3 = S_PrecacheSound ("weapons/ric3.wav", false, true);
- cl_sfx_r_exp3 = S_PrecacheSound ("weapons/r_exp3.wav", false, true);
+ cl_sfx_wizhit = S_PrecacheSound ("sound/wizard/hit.wav", false, true);
+ cl_sfx_knighthit = S_PrecacheSound ("sound/hknight/hit.wav", false, true);
+ cl_sfx_tink1 = S_PrecacheSound ("sound/weapons/tink1.wav", false, true);
+ cl_sfx_ric1 = S_PrecacheSound ("sound/weapons/ric1.wav", false, true);
+ cl_sfx_ric2 = S_PrecacheSound ("sound/weapons/ric2.wav", false, true);
+ cl_sfx_ric3 = S_PrecacheSound ("sound/weapons/ric3.wav", false, true);
+ cl_sfx_r_exp3 = S_PrecacheSound ("sound/weapons/r_exp3.wav", false, true);
}
void CL_ParseBeam (model_t *m, int lightning)
MSG_ReadVector(pos, cl.protocol);
CL_FindNonSolidLocation(pos, pos, 4);
Matrix4x4_CreateTranslate(&tempmatrix, pos[0], pos[1], pos[2]);
- CL_AllocDlight(NULL, &tempmatrix, 100, 0.12f, 0.50f, 0.12f, 500, 0.2, 0, 0, false, 1);
+ CL_AllocDlight(NULL, &tempmatrix, 100, 0.12f, 0.50f, 0.12f, 500, 0.2, 0, 0, false, 1, 0.25, 1, 0, 0, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
CL_RunParticleEffect(pos, vec3_origin, 20, 30);
S_StartSound(-1, 0, cl_sfx_wizhit, pos, 1, 1);
break;
MSG_ReadVector(pos, cl.protocol);
CL_FindNonSolidLocation(pos, pos, 4);
Matrix4x4_CreateTranslate(&tempmatrix, pos[0], pos[1], pos[2]);
- CL_AllocDlight(NULL, &tempmatrix, 100, 0.50f, 0.30f, 0.10f, 500, 0.2, 0, 0, false, 1);
+ CL_AllocDlight(NULL, &tempmatrix, 100, 0.50f, 0.30f, 0.10f, 500, 0.2, 0, 0, false, 1, 0.25, 1, 0, 0, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
CL_RunParticleEffect(pos, vec3_origin, 226, 20);
S_StartSound(-1, 0, cl_sfx_knighthit, pos, 1, 1);
break;
// spike hitting wall
MSG_ReadVector(pos, cl.protocol);
CL_FindNonSolidLocation(pos, pos, 4);
- // LordHavoc: changed to spark shower
- CL_SparkShower(pos, vec3_origin, 15);
+ if (cl_particles_bulletimpacts.integer)
+ {
+ CL_SparkShower(pos, vec3_origin, 15, 1);
+ CL_Smoke(pos, vec3_origin, 15);
+ CL_BulletMark(pos);
+ }
if (rand() % 5)
S_StartSound(-1, 0, cl_sfx_tink1, pos, 1, 1);
else
MSG_ReadVector(pos, cl.protocol);
CL_FindNonSolidLocation(pos, pos, 4);
// LordHavoc: changed to spark shower
- CL_SparkShower(pos, vec3_origin, 15);
+ if (cl_particles_bulletimpacts.integer)
+ {
+ CL_SparkShower(pos, vec3_origin, 15, 1);
+ CL_Smoke(pos, vec3_origin, 15);
+ CL_BulletMark(pos);
+ }
Matrix4x4_CreateTranslate(&tempmatrix, pos[0], pos[1], pos[2]);
- CL_AllocDlight(NULL, &tempmatrix, 100, 0.15f, 0.15f, 1.5f, 500, 0.2, 0, 0, true, 1);
+ CL_AllocDlight(NULL, &tempmatrix, 100, 0.15f, 0.15f, 1.5f, 500, 0.2, 0, 0, true, 1, 0.25, 1, 0, 0, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
S_StartSound(-1, 0, cl_sfx_r_exp3, pos, 1, 1);
if (rand() % 5)
S_StartSound(-1, 0, cl_sfx_tink1, pos, 1, 1);
MSG_ReadVector(pos, cl.protocol);
CL_FindNonSolidLocation(pos, pos, 4);
// LordHavoc: changed to dust shower
- CL_SparkShower(pos, vec3_origin, 30);
+ if (cl_particles_bulletimpacts.integer)
+ {
+ CL_SparkShower(pos, vec3_origin, 30, 1);
+ CL_Smoke(pos, vec3_origin, 30);
+ CL_BulletMark(pos);
+ }
if (rand() % 5)
S_StartSound(-1, 0, cl_sfx_tink1, pos, 1, 1);
else
MSG_ReadVector(pos, cl.protocol);
CL_FindNonSolidLocation(pos, pos, 4);
// LordHavoc: changed to dust shower
- CL_SparkShower(pos, vec3_origin, 30);
+ if (cl_particles_bulletimpacts.integer)
+ {
+ CL_SparkShower(pos, vec3_origin, 30, 1);
+ CL_Smoke(pos, vec3_origin, 30);
+ CL_BulletMark(pos);
+ }
Matrix4x4_CreateTranslate(&tempmatrix, pos[0], pos[1], pos[2]);
- CL_AllocDlight(NULL, &tempmatrix, 100, 0.15f, 0.15f, 1.5f, 500, 0.2, 0, 0, true, 1);
+ CL_AllocDlight(NULL, &tempmatrix, 100, 0.15f, 0.15f, 1.5f, 500, 0.2, 0, 0, true, 1, 0.25, 1, 0, 0, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
if (rand() % 5)
S_StartSound(-1, 0, cl_sfx_tink1, pos, 1, 1);
else
dir[1] = MSG_ReadChar();
dir[2] = MSG_ReadChar();
count = MSG_ReadByte();
- CL_SparkShower(pos, dir, count);
+ CL_SparkShower(pos, dir, count, 1);
break;
case TE_PLASMABURN:
MSG_ReadVector(pos, cl.protocol);
CL_FindNonSolidLocation(pos, pos, 4);
Matrix4x4_CreateTranslate(&tempmatrix, pos[0], pos[1], pos[2]);
- CL_AllocDlight(NULL, &tempmatrix, 200, 1, 1, 1, 1000, 0.2, 0, 0, true, 1);
+ CL_AllocDlight(NULL, &tempmatrix, 200, 1, 1, 1, 1000, 0.2, 0, 0, true, 1, 0.25, 1, 0, 0, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
CL_PlasmaBurn(pos);
break;
// LordHavoc: added for improved gore
// bullet hitting wall
MSG_ReadVector(pos, cl.protocol);
CL_FindNonSolidLocation(pos, pos, 4);
- // LordHavoc: changed to dust shower
- CL_SparkShower(pos, vec3_origin, 15);
+ CL_SparkShower(pos, vec3_origin, 15, 1);
+ CL_Smoke(pos, vec3_origin, 15);
+ CL_BulletMark(pos);
break;
case TE_GUNSHOTQUAD:
// quad bullet hitting wall
MSG_ReadVector(pos, cl.protocol);
CL_FindNonSolidLocation(pos, pos, 4);
- CL_SparkShower(pos, vec3_origin, 15);
+ CL_SparkShower(pos, vec3_origin, 15, 1);
+ CL_Smoke(pos, vec3_origin, 15);
+ CL_BulletMark(pos);
Matrix4x4_CreateTranslate(&tempmatrix, pos[0], pos[1], pos[2]);
- CL_AllocDlight(NULL, &tempmatrix, 100, 0.15f, 0.15f, 1.5f, 500, 0.2, 0, 0, true, 1);
+ CL_AllocDlight(NULL, &tempmatrix, 100, 0.15f, 0.15f, 1.5f, 500, 0.2, 0, 0, true, 1, 0.25, 1, 0, 0, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
break;
case TE_EXPLOSION:
CL_ParticleExplosion(pos);
// LordHavoc: boosted color from 1.0, 0.8, 0.4 to 1.25, 1.0, 0.5
Matrix4x4_CreateTranslate(&tempmatrix, pos[0], pos[1], pos[2]);
- CL_AllocDlight(NULL, &tempmatrix, 350, 4.0f, 2.0f, 0.50f, 700, 0.5, 0, 0, true, 1);
+ CL_AllocDlight(NULL, &tempmatrix, 350, 4.0f, 2.0f, 0.50f, 700, 0.5, 0, 0, true, 1, 0.25, 0.25, 1, 1, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
S_StartSound(-1, 0, cl_sfx_r_exp3, pos, 1, 1);
break;
CL_FindNonSolidLocation(pos, pos, 10);
CL_ParticleExplosion(pos);
Matrix4x4_CreateTranslate(&tempmatrix, pos[0], pos[1], pos[2]);
- CL_AllocDlight(NULL, &tempmatrix, 350, 2.5f, 2.0f, 4.0f, 700, 0.5, 0, 0, true, 1);
+ CL_AllocDlight(NULL, &tempmatrix, 350, 2.5f, 2.0f, 4.0f, 700, 0.5, 0, 0, true, 1, 0.25, 0.25, 1, 1, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
S_StartSound(-1, 0, cl_sfx_r_exp3, pos, 1, 1);
break;
color[0] = MSG_ReadCoord(cl.protocol) * (2.0f / 1.0f);
color[1] = MSG_ReadCoord(cl.protocol) * (2.0f / 1.0f);
color[2] = MSG_ReadCoord(cl.protocol) * (2.0f / 1.0f);
- CL_AllocDlight(NULL, &tempmatrix, 350, color[0], color[1], color[2], 700, 0.5, 0, 0, true, 1);
+ CL_AllocDlight(NULL, &tempmatrix, 350, color[0], color[1], color[2], 700, 0.5, 0, 0, true, 1, 0.25, 0.25, 1, 1, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
S_StartSound(-1, 0, cl_sfx_r_exp3, pos, 1, 1);
break;
color[1] = MSG_ReadByte() * (2.0f / 255.0f);
color[2] = MSG_ReadByte() * (2.0f / 255.0f);
Matrix4x4_CreateTranslate(&tempmatrix, pos[0], pos[1], pos[2]);
- CL_AllocDlight(NULL, &tempmatrix, 350, color[0], color[1], color[2], 700, 0.5, 0, 0, true, 1);
+ CL_AllocDlight(NULL, &tempmatrix, 350, color[0], color[1], color[2], 700, 0.5, 0, 0, true, 1, 0.25, 0.25, 1, 1, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
S_StartSound(-1, 0, cl_sfx_r_exp3, pos, 1, 1);
break;
S_StartSound(-1, 0, cl_sfx_r_exp3, pos, 1, 1);
S_StartSound(-1, 0, cl_sfx_r_exp3, pos, 1, 1);
Matrix4x4_CreateTranslate(&tempmatrix, pos[0], pos[1], pos[2]);
- CL_AllocDlight(NULL, &tempmatrix, 600, 1.6f, 0.8f, 2.0f, 1200, 0.5, 0, 0, true, 1);
+ CL_AllocDlight(NULL, &tempmatrix, 600, 1.6f, 0.8f, 2.0f, 1200, 0.5, 0, 0, true, 1, 0.25, 0.25, 1, 1, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
break;
case TE_SMALLFLASH:
MSG_ReadVector(pos, cl.protocol);
CL_FindNonSolidLocation(pos, pos, 10);
Matrix4x4_CreateTranslate(&tempmatrix, pos[0], pos[1], pos[2]);
- CL_AllocDlight(NULL, &tempmatrix, 200, 2, 2, 2, 1000, 0.2, 0, 0, true, 1);
+ CL_AllocDlight(NULL, &tempmatrix, 200, 2, 2, 2, 1000, 0.2, 0, 0, true, 1, 0.25, 1, 0, 0, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
break;
case TE_CUSTOMFLASH:
color[1] = MSG_ReadByte() * (2.0f / 255.0f);
color[2] = MSG_ReadByte() * (2.0f / 255.0f);
Matrix4x4_CreateTranslate(&tempmatrix, pos[0], pos[1], pos[2]);
- CL_AllocDlight(NULL, &tempmatrix, radius, color[0], color[1], color[2], radius / velspeed, velspeed, 0, 0, true, 1);
+ CL_AllocDlight(NULL, &tempmatrix, radius, color[0], color[1], color[2], radius / velspeed, velspeed, 0, 0, true, 1, 0.25, 1, 1, 1, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
break;
case TE_FLAMEJET:
case TE_TELEPORT:
MSG_ReadVector(pos, cl.protocol);
Matrix4x4_CreateTranslate(&tempmatrix, pos[0], pos[1], pos[2]);
- CL_AllocDlight(NULL, &tempmatrix, 500, 1.0f, 1.0f, 1.0f, 1500, 99.0f, 0, 0, true, 1);
+ CL_AllocDlight(NULL, &tempmatrix, 500, 1.0f, 1.0f, 1.0f, 1500, 99.0f, 0, 0, true, 1, 0.25, 1, 0, 0, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
// CL_TeleportSplash(pos);
break;
color[1] = tempcolor[1] * (2.0f / 255.0f);
color[2] = tempcolor[2] * (2.0f / 255.0f);
Matrix4x4_CreateTranslate(&tempmatrix, pos[0], pos[1], pos[2]);
- CL_AllocDlight(NULL, &tempmatrix, 350, color[0], color[1], color[2], 700, 0.5, 0, 0, true, 1);
+ CL_AllocDlight(NULL, &tempmatrix, 350, color[0], color[1], color[2], 700, 0.5, 0, 0, true, 1, 0.25, 0.25, 1, 1, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
S_StartSound(-1, 0, cl_sfx_r_exp3, pos, 1, 1);
break;
CL_FindNonSolidLocation(pos, pos, 10);
CL_ParticleExplosion(pos);
Matrix4x4_CreateTranslate(&tempmatrix, pos[0], pos[1], pos[2]);
- CL_AllocDlight(NULL, &tempmatrix, 500, 2.5f, 2.0f, 1.0f, 500, 9999, 0, 0, true, 1);
+ CL_AllocDlight(NULL, &tempmatrix, 500, 2.5f, 2.0f, 1.0f, 500, 9999, 0, 0, true, 1, 0.25, 0.25, 1, 1, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
S_StartSound(-1, 0, cl_sfx_r_exp3, pos, 1, 1);
break;
CL_FindNonSolidLocation(pos, pos, 5);
CL_Tei_PlasmaHit(pos, dir, count);
Matrix4x4_CreateTranslate(&tempmatrix, pos[0], pos[1], pos[2]);
- CL_AllocDlight(NULL, &tempmatrix, 500, 0.6, 1.2, 2.0f, 2000, 9999, 0, 0, true, 1);
+ CL_AllocDlight(NULL, &tempmatrix, 500, 0.6, 1.2, 2.0f, 2000, 9999, 0, 0, true, 1, 0.25, 0.25, 1, 1, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
break;
default:
case svc_setpause:
cl.paused = MSG_ReadByte ();
if (cl.paused)
- {
CDAudio_Pause ();
- S_PauseGameSounds ();
- }
else
- {
CDAudio_Resume ();
- S_ResumeGameSounds ();
- }
+ S_PauseGameSounds (cl.paused);
break;
case svc_signonnum: