r_refdef.scene.numtempentities = 0;
}
-entity_render_t *CL_NewTempEntity(void)
+entity_render_t *CL_NewTempEntity(double shadertime)
{
entity_render_t *render;
memset (render, 0, sizeof(*render));
r_refdef.scene.entities[r_refdef.scene.numentities++] = render;
+ render->shadertime = shadertime;
render->alpha = 1;
VectorSet(render->colormod, 1, 1, 1);
return render;
}
// end of code taken from QuakeWorld
- flagrender = CL_NewTempEntity();
+ flagrender = CL_NewTempEntity(player->render.shadertime);
if (!flagrender)
return;
// if we're drawing effects, get a new temp entity
// (NewTempEntity adds it to the render entities list for us)
- if (r_draweffects.integer && (entrender = CL_NewTempEntity()))
+ if (r_draweffects.integer && (entrender = CL_NewTempEntity(e->starttime)))
{
// interpolation stuff
entrender->frame1 = intframe;
d = VectorNormalizeLength(dist);
while (d > 0)
{
- entrender = CL_NewTempEntity ();
+ entrender = CL_NewTempEntity (0);
if (!entrender)
return;
//VectorCopy (org, ent->render.origin);
// if we're drawing effects, get a new temp entity
// (NewTempEntity adds it to the render entities list for us)
- if (!(entrender = CL_NewTempEntity()))
+ if (!(entrender = CL_NewTempEntity(0)))
continue;
// normal stuff
ent->render.frame1 = ent->render.frame2 = ent->state_current.frame;
ent->render.frame1time = ent->render.frame2time = cl.time;
ent->render.framelerp = 1;
+ ent->render.shadertime = cl.time;
// reset various persistent stuff
ent->persistent.muzzleflash = 0;
ent->persistent.trail_allowed = false;
if (!model)
return false;
- entrender = CL_NewTempEntity();
+ entrender = CL_NewTempEntity(0);
if (!entrender)
return false;
if ((val = PRVM_EDICTFIELDVALUE(ed, prog->fieldoffsets.frame1time))) entrender->frame2time = val->_float;
if ((val = PRVM_EDICTFIELDVALUE(ed, prog->fieldoffsets.frame2time))) entrender->frame1time = val->_float;
if ((val = PRVM_EDICTFIELDVALUE(ed, prog->fieldoffsets.lerpfrac))) entrender->framelerp = val->_float;
+ if ((val = PRVM_EDICTFIELDVALUE(ed, prog->fieldoffsets.shadertime))) entrender->shadertime = val->_float;
// concat the matrices to make the entity relative to its tag
Matrix4x4_Concat(&entrender->matrix, &tagmatrix, &matrix2);
}
t->currentskinframe = r_qwskincache_skinframe[i];
if (t->currentskinframe == NULL)
- t->currentskinframe = t->skinframes[(int)(t->skinframerate * (cl.time - ent->frame2time)) % t->numskinframes];
+ t->currentskinframe = t->skinframes[(int)(t->skinframerate * (cl.time - ent->shadertime)) % t->numskinframes];
}
else if (t->numskinframes >= 2)
- t->currentskinframe = t->skinframes[(int)(t->skinframerate * (cl.time - ent->frame2time)) % t->numskinframes];
+ t->currentskinframe = t->skinframes[(int)(t->skinframerate * (cl.time - ent->shadertime)) % t->numskinframes];
if (t->backgroundnumskinframes >= 2)
- t->backgroundcurrentskinframe = t->backgroundskinframes[(int)(t->backgroundskinframerate * (cl.time - ent->frame2time)) % t->backgroundnumskinframes];
+ t->backgroundcurrentskinframe = t->backgroundskinframes[(int)(t->backgroundskinframerate * (cl.time - ent->shadertime)) % t->backgroundnumskinframes];
t->currentmaterialflags = t->basematerialflags;
t->currentalpha = ent->alpha;
int frame1time; // csqc
int frame2; // csqc
int frame2time; // csqc
+ int shadertime; // csqc
int frame; // common - used by OP_STATE
int fullbright; // ssqc - Nehahra support
int glow_color; // ssqc
prog->fieldoffsets.frame1time = PRVM_ED_FindFieldOffset("frame1time");
prog->fieldoffsets.frame2 = PRVM_ED_FindFieldOffset("frame2");
prog->fieldoffsets.frame2time = PRVM_ED_FindFieldOffset("frame2time");
+ prog->fieldoffsets.shadertime = PRVM_ED_FindFieldOffset("shadertime");
prog->fieldoffsets.fullbright = PRVM_ED_FindFieldOffset("fullbright");
prog->fieldoffsets.glow_color = PRVM_ED_FindFieldOffset("glow_color");
prog->fieldoffsets.glow_size = PRVM_ED_FindFieldOffset("glow_size");
prog->globaloffsets.drawfont = PRVM_ED_FindGlobalOffset("drawfont");
prog->globaloffsets.require_spawnfunc_prefix = PRVM_ED_FindGlobalOffset("require_spawnfunc_prefix");
prog->globaloffsets.worldstatus = PRVM_ED_FindGlobalOffset("worldstatus");
+ prog->globaloffsets.servertime = PRVM_ED_FindGlobalOffset("servertime");
+ prog->globaloffsets.serverprevtime = PRVM_ED_FindGlobalOffset("serverprevtime");
+ prog->globaloffsets.serverdeltatime = PRVM_ED_FindGlobalOffset("serverdeltatime");
// menu qc only uses some functions, nothing else
prog->funcoffsets.m_draw = PRVM_ED_FindFunctionOffset("m_draw");