From: havoc Date: Sun, 18 Mar 2012 19:07:28 +0000 (+0000) Subject: VM_FrameBlendFromFrameGroupBlend was using cl.time even on server X-Git-Tag: xonotic-v0.7.0~196 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=9fda408670255c4e0c608cd320ed3a0054d41499;p=xonotic%2Fdarkplaces.git VM_FrameBlendFromFrameGroupBlend was using cl.time even on server git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11762 d7cf8633-e32d-0410-b094-e92efae38249 ::stable-branch::merge=d2036753773b0c3c0a5347bc48c82cb7eca296af --- diff --git a/cl_main.c b/cl_main.c index 94562c27..20451c8e 100644 --- a/cl_main.c +++ b/cl_main.c @@ -552,7 +552,7 @@ void CL_UpdateRenderEntity(entity_render_t *ent) // update the inverse matrix for the renderer Matrix4x4_Invert_Simple(&ent->inversematrix, &ent->matrix); // update the animation blend state - VM_FrameBlendFromFrameGroupBlend(ent->frameblend, ent->framegroupblend, ent->model); + VM_FrameBlendFromFrameGroupBlend(ent->frameblend, ent->framegroupblend, ent->model, cl.time); // we need the matrix origin to center the box Matrix4x4_OriginFromMatrix(&ent->matrix, org); // update entity->render.scale because the renderer needs it @@ -1600,7 +1600,7 @@ static void CL_RelinkStaticEntities(void) e->render.flags |= RENDER_SHADOW; VectorSet(e->render.colormod, 1, 1, 1); VectorSet(e->render.glowmod, 1, 1, 1); - VM_FrameBlendFromFrameGroupBlend(e->render.frameblend, e->render.framegroupblend, e->render.model); + VM_FrameBlendFromFrameGroupBlend(e->render.frameblend, e->render.framegroupblend, e->render.model, cl.time); e->render.allowdecals = true; CL_UpdateRenderEntity(&e->render); r_refdef.scene.entities[r_refdef.scene.numentities++] = &e->render; diff --git a/clvm_cmds.c b/clvm_cmds.c index d03b632e..1bc83027 100644 --- a/clvm_cmds.c +++ b/clvm_cmds.c @@ -2380,7 +2380,7 @@ static int CL_GetEntityLocalTagMatrix(prvm_prog_t *prog, prvm_edict_t *ent, int && model->animscenes) { VM_GenerateFrameGroupBlend(prog, ent->priv.server->framegroupblend, ent); - VM_FrameBlendFromFrameGroupBlend(ent->priv.server->frameblend, ent->priv.server->framegroupblend, model); + VM_FrameBlendFromFrameGroupBlend(ent->priv.server->frameblend, ent->priv.server->framegroupblend, model, cl.time); VM_UpdateEdictSkeleton(prog, ent, model, ent->priv.server->frameblend); return Mod_Alias_GetTagMatrix(model, ent->priv.server->frameblend, &ent->priv.server->skeleton, tagindex, out); } @@ -2532,7 +2532,7 @@ static void VM_CL_gettaginfo (prvm_prog_t *prog) VectorScale(le, -1, PRVM_clientglobalvector(v_right)); model = CL_GetModelFromEdict(e); VM_GenerateFrameGroupBlend(prog, e->priv.server->framegroupblend, e); - VM_FrameBlendFromFrameGroupBlend(e->priv.server->frameblend, e->priv.server->framegroupblend, model); + VM_FrameBlendFromFrameGroupBlend(e->priv.server->frameblend, e->priv.server->framegroupblend, model, cl.time); VM_UpdateEdictSkeleton(prog, e, model, e->priv.server->frameblend); CL_GetExtendedTagInfo(prog, e, tagindex, &parentindex, &tagname, &tag_localmatrix); Matrix4x4_ToVectors(&tag_localmatrix, fo, le, up, trans); @@ -3846,7 +3846,7 @@ static void VM_CL_skel_build(prvm_prog_t *prog) lastbone = min(lastbone, model->num_bones - 1); lastbone = min(lastbone, skeleton->model->num_bones - 1); VM_GenerateFrameGroupBlend(prog, framegroupblend, ed); - VM_FrameBlendFromFrameGroupBlend(frameblend, framegroupblend, model); + VM_FrameBlendFromFrameGroupBlend(frameblend, framegroupblend, model, cl.time); blendfrac = 1.0f - retainfrac; for (numblends = 0;numblends < MAX_FRAMEBLENDS && frameblend[numblends].lerp;numblends++) frameblend[numblends].lerp *= blendfrac; diff --git a/csprogs.c b/csprogs.c index 7faa8877..ffb5d724 100644 --- a/csprogs.c +++ b/csprogs.c @@ -348,7 +348,7 @@ qboolean CSQC_AddRenderEdict(prvm_edict_t *ed, int edictnum) // set up the animation data VM_GenerateFrameGroupBlend(prog, ed->priv.server->framegroupblend, ed); - VM_FrameBlendFromFrameGroupBlend(ed->priv.server->frameblend, ed->priv.server->framegroupblend, model); + VM_FrameBlendFromFrameGroupBlend(ed->priv.server->frameblend, ed->priv.server->framegroupblend, model, cl.time); VM_UpdateEdictSkeleton(prog, ed, model, ed->priv.server->frameblend); if (PRVM_clientedictfloat(ed, shadertime)) // hack for csprogs.dat files that do not set shadertime, leaves the value at entity spawn time entrender->shadertime = PRVM_clientedictfloat(ed, shadertime); diff --git a/progsvm.h b/progsvm.h index 0082938d..b87822a4 100644 --- a/progsvm.h +++ b/progsvm.h @@ -863,7 +863,7 @@ void PRVM_StackTrace(prvm_prog_t *prog); void VM_Warning(prvm_prog_t *prog, const char *fmt, ...) DP_FUNC_PRINTF(2); void VM_GenerateFrameGroupBlend(prvm_prog_t *prog, framegroupblend_t *framegroupblend, const prvm_edict_t *ed); -void VM_FrameBlendFromFrameGroupBlend(frameblend_t *frameblend, const framegroupblend_t *framegroupblend, const dp_model_t *model); +void VM_FrameBlendFromFrameGroupBlend(frameblend_t *frameblend, const framegroupblend_t *framegroupblend, const dp_model_t *model, double curtime); void VM_UpdateEdictSkeleton(prvm_prog_t *prog, prvm_edict_t *ed, const dp_model_t *edmodel, const frameblend_t *frameblend); void VM_RemoveEdictSkeleton(prvm_prog_t *prog, prvm_edict_t *ed); diff --git a/prvm_cmds.c b/prvm_cmds.c index b7ae1881..c4a48668 100644 --- a/prvm_cmds.c +++ b/prvm_cmds.c @@ -85,7 +85,7 @@ void VM_GenerateFrameGroupBlend(prvm_prog_t *prog, framegroupblend_t *framegroup // LordHavoc: quite tempting to break apart this function to reuse the // duplicated code, but I suspect it is better for performance // this way -void VM_FrameBlendFromFrameGroupBlend(frameblend_t *frameblend, const framegroupblend_t *framegroupblend, const dp_model_t *model) +void VM_FrameBlendFromFrameGroupBlend(frameblend_t *frameblend, const framegroupblend_t *framegroupblend, const dp_model_t *model, double curtime) { int sub2, numframes, f, i, k; int isfirstframegroup = true; @@ -134,7 +134,7 @@ void VM_FrameBlendFromFrameGroupBlend(frameblend_t *frameblend, const framegroup if (scene->framecount > 1) { // this code path is only used on .zym models and torches - sublerp = scene->framerate * (cl.time - g->start); + sublerp = scene->framerate * (curtime - g->start); f = (int) floor(sublerp); sublerp -= f; sub2 = f + 1; @@ -6429,7 +6429,7 @@ static void animatemodel(prvm_prog_t *prog, dp_model_t *model, prvm_edict_t *ed) memset(&animatemodel_cache, 0, sizeof(animatemodel_cache)); need |= (animatemodel_cache.model != model); VM_GenerateFrameGroupBlend(prog, ed->priv.server->framegroupblend, ed); - VM_FrameBlendFromFrameGroupBlend(ed->priv.server->frameblend, ed->priv.server->framegroupblend, model); + VM_FrameBlendFromFrameGroupBlend(ed->priv.server->frameblend, ed->priv.server->framegroupblend, model, PRVM_serverglobalfloat(time)); need |= (memcmp(&animatemodel_cache.frameblend, &ed->priv.server->frameblend, sizeof(ed->priv.server->frameblend))) != 0; skeletonindex = (int)PRVM_gameedictfloat(ed, skeletonindex) - 1; if (!(skeletonindex >= 0 && skeletonindex < MAX_EDICTS && (skeleton = prog->skeletons[skeletonindex]) && skeleton->model->num_bones == ed->priv.server->skeleton.model->num_bones)) diff --git a/sv_phys.c b/sv_phys.c index e063526f..66951105 100644 --- a/sv_phys.c +++ b/sv_phys.c @@ -224,7 +224,7 @@ trace_t SV_TracePoint(const vec3_t start, int type, prvm_edict_t *passedict, int Matrix4x4_CreateTranslate(&matrix, PRVM_serveredictvector(touch, origin)[0], PRVM_serveredictvector(touch, origin)[1], PRVM_serveredictvector(touch, origin)[2]); Matrix4x4_Invert_Simple(&imatrix, &matrix); VM_GenerateFrameGroupBlend(prog, touch->priv.server->framegroupblend, touch); - VM_FrameBlendFromFrameGroupBlend(touch->priv.server->frameblend, touch->priv.server->framegroupblend, model); + VM_FrameBlendFromFrameGroupBlend(touch->priv.server->frameblend, touch->priv.server->framegroupblend, model, sv.time); VM_UpdateEdictSkeleton(prog, touch, model, touch->priv.server->frameblend); if (type == MOVE_MISSILE && (int)PRVM_serveredictfloat(touch, flags) & FL_MONSTER) Collision_ClipToGenericEntity(&trace, model, touch->priv.server->frameblend, &touch->priv.server->skeleton, PRVM_serveredictvector(touch, mins), PRVM_serveredictvector(touch, maxs), bodysupercontents, &matrix, &imatrix, clipstart, clipmins2, clipmaxs2, clipstart, hitsupercontentsmask); @@ -391,7 +391,7 @@ trace_t SV_TraceLine(const vec3_t start, const vec3_t end, int type, prvm_edict_ Matrix4x4_CreateTranslate(&matrix, PRVM_serveredictvector(touch, origin)[0], PRVM_serveredictvector(touch, origin)[1], PRVM_serveredictvector(touch, origin)[2]); Matrix4x4_Invert_Simple(&imatrix, &matrix); VM_GenerateFrameGroupBlend(prog, touch->priv.server->framegroupblend, touch); - VM_FrameBlendFromFrameGroupBlend(touch->priv.server->frameblend, touch->priv.server->framegroupblend, model); + VM_FrameBlendFromFrameGroupBlend(touch->priv.server->frameblend, touch->priv.server->framegroupblend, model, sv.time); VM_UpdateEdictSkeleton(prog, touch, model, touch->priv.server->frameblend); if (type == MOVE_MISSILE && (int)PRVM_serveredictfloat(touch, flags) & FL_MONSTER) Collision_ClipToGenericEntity(&trace, model, touch->priv.server->frameblend, &touch->priv.server->skeleton, PRVM_serveredictvector(touch, mins), PRVM_serveredictvector(touch, maxs), bodysupercontents, &matrix, &imatrix, clipstart, clipmins2, clipmaxs2, clipend, hitsupercontentsmask); @@ -605,7 +605,7 @@ trace_t SV_TraceBox(const vec3_t start, const vec3_t mins, const vec3_t maxs, co Matrix4x4_CreateTranslate(&matrix, PRVM_serveredictvector(touch, origin)[0], PRVM_serveredictvector(touch, origin)[1], PRVM_serveredictvector(touch, origin)[2]); Matrix4x4_Invert_Simple(&imatrix, &matrix); VM_GenerateFrameGroupBlend(prog, touch->priv.server->framegroupblend, touch); - VM_FrameBlendFromFrameGroupBlend(touch->priv.server->frameblend, touch->priv.server->framegroupblend, model); + VM_FrameBlendFromFrameGroupBlend(touch->priv.server->frameblend, touch->priv.server->framegroupblend, model, sv.time); VM_UpdateEdictSkeleton(prog, touch, model, touch->priv.server->frameblend); if (type == MOVE_MISSILE && (int)PRVM_serveredictfloat(touch, flags) & FL_MONSTER) Collision_ClipToGenericEntity(&trace, model, touch->priv.server->frameblend, &touch->priv.server->skeleton, PRVM_serveredictvector(touch, mins), PRVM_serveredictvector(touch, maxs), bodysupercontents, &matrix, &imatrix, clipstart, clipmins2, clipmaxs2, clipend, hitsupercontentsmask); @@ -855,7 +855,7 @@ void SV_LinkEdict (prvm_edict_t *ent) model = SV_GetModelByIndex(modelindex); VM_GenerateFrameGroupBlend(prog, ent->priv.server->framegroupblend, ent); - VM_FrameBlendFromFrameGroupBlend(ent->priv.server->frameblend, ent->priv.server->framegroupblend, model); + VM_FrameBlendFromFrameGroupBlend(ent->priv.server->frameblend, ent->priv.server->framegroupblend, model, sv.time); VM_UpdateEdictSkeleton(prog, ent, model, ent->priv.server->frameblend); // set the abs box diff --git a/svvm_cmds.c b/svvm_cmds.c index a850abe3..92100b28 100644 --- a/svvm_cmds.c +++ b/svvm_cmds.c @@ -2430,7 +2430,7 @@ static int SV_GetEntityLocalTagMatrix(prvm_prog_t *prog, prvm_edict_t *ent, int if (tagindex >= 0 && (model = SV_GetModelFromEdict(ent)) && model->animscenes) { VM_GenerateFrameGroupBlend(prog, ent->priv.server->framegroupblend, ent); - VM_FrameBlendFromFrameGroupBlend(ent->priv.server->frameblend, ent->priv.server->framegroupblend, model); + VM_FrameBlendFromFrameGroupBlend(ent->priv.server->frameblend, ent->priv.server->framegroupblend, model, sv.time); VM_UpdateEdictSkeleton(prog, ent, model, ent->priv.server->frameblend); return Mod_Alias_GetTagMatrix(model, ent->priv.server->frameblend, &ent->priv.server->skeleton, tagindex, out); } @@ -2469,7 +2469,7 @@ static int SV_GetTagMatrix (prvm_prog_t *prog, matrix4x4_t *out, prvm_edict_t *e model = SV_GetModelByIndex(modelindex); VM_GenerateFrameGroupBlend(prog, ent->priv.server->framegroupblend, ent); - VM_FrameBlendFromFrameGroupBlend(ent->priv.server->frameblend, ent->priv.server->framegroupblend, model); + VM_FrameBlendFromFrameGroupBlend(ent->priv.server->frameblend, ent->priv.server->framegroupblend, model, sv.time); VM_UpdateEdictSkeleton(prog, ent, model, ent->priv.server->frameblend); tagmatrix = identitymatrix; @@ -2593,7 +2593,7 @@ static void VM_SV_gettaginfo(prvm_prog_t *prog) VectorScale(le, -1, PRVM_serverglobalvector(v_right)); model = SV_GetModelFromEdict(e); VM_GenerateFrameGroupBlend(prog, e->priv.server->framegroupblend, e); - VM_FrameBlendFromFrameGroupBlend(e->priv.server->frameblend, e->priv.server->framegroupblend, model); + VM_FrameBlendFromFrameGroupBlend(e->priv.server->frameblend, e->priv.server->framegroupblend, model, sv.time); VM_UpdateEdictSkeleton(prog, e, model, e->priv.server->frameblend); SV_GetExtendedTagInfo(prog, e, tagindex, &parentindex, &tagname, &tag_localmatrix); Matrix4x4_ToVectors(&tag_localmatrix, fo, le, up, trans); @@ -2902,7 +2902,7 @@ static void VM_SV_skel_build(prvm_prog_t *prog) lastbone = min(lastbone, model->num_bones - 1); lastbone = min(lastbone, skeleton->model->num_bones - 1); VM_GenerateFrameGroupBlend(prog, framegroupblend, ed); - VM_FrameBlendFromFrameGroupBlend(frameblend, framegroupblend, model); + VM_FrameBlendFromFrameGroupBlend(frameblend, framegroupblend, model, sv.time); blendfrac = 1.0f - retainfrac; for (numblends = 0;numblends < MAX_FRAMEBLENDS && frameblend[numblends].lerp;numblends++) frameblend[numblends].lerp *= blendfrac;