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);
}
/*
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)
{
- // we definitely shouldn't lerp
+ // 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)
+ {
+ // 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)
i = MSG_ReadByte ();
if (i >= cl.maxclients)
Host_Error ("CL_ParseServerMessage: svc_updatefrags >= cl.maxclients");
- cl.scores[i].frags = (unsigned short) MSG_ReadShort ();
+ cl.scores[i].frags = (signed short) MSG_ReadShort ();
break;
case svc_updatecolors:
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: