mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 08:51:24 +00:00
- deleted updateanimation function for models.
It is currently unused and will certainly have to redone once model support is added for the new renderer. Since this tries to guess game state from purely engine-side data it has its share of major problems, most importantly it is not compatible with games other than Duke.
This commit is contained in:
parent
4260d334e2
commit
3ca9052b7a
2 changed files with 0 additions and 141 deletions
|
@ -182,7 +182,6 @@ int32_t lintersect(int32_t originX, int32_t originY, int32_t originZ,
|
|||
int32_t *intersectionX, int32_t *intersectionY, int32_t *intersectionZ);
|
||||
|
||||
|
||||
EXTERN_CVAR(Bool, hw_animsmoothing)
|
||||
EXTERN_CVAR(Bool, hw_hightile)
|
||||
EXTERN_CVAR(Bool, hw_models)
|
||||
EXTERN_CVAR(Float, gl_texture_filter_anisotropic)
|
||||
|
|
|
@ -392,146 +392,6 @@ FGameTexture *mdloadskin(idmodel_t *m, int32_t number, int32_t pal, int32_t surf
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
//Note: even though it says md2model, it works for both md2model&md3model
|
||||
static void updateanimation(md2model_t *m, tspritetype* tspr, uint8_t lpal)
|
||||
{
|
||||
if (m->numframes < 2)
|
||||
{
|
||||
m->interpol = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
int32_t const tile = Ptile2tile(tspr->picnum,lpal);
|
||||
m->cframe = m->nframe = tile2model[tile].framenum;
|
||||
|
||||
auto ownerActor = tspr->ownerActor;
|
||||
int32_t const smoothdurationp = (hw_animsmoothing && (tile2model[tile].smoothduration != 0));
|
||||
|
||||
const mdanim_t *anim;
|
||||
for (anim = m->animations; anim && anim->startframe != m->cframe; anim = anim->next)
|
||||
{
|
||||
/* do nothing */;
|
||||
}
|
||||
|
||||
int32_t i, j, k;
|
||||
int32_t fps;
|
||||
|
||||
if (!anim)
|
||||
{
|
||||
if (!smoothdurationp || ((ownerActor->spsmooth.mdoldframe == m->cframe) && (ownerActor->spsmooth.mdcurframe == m->cframe)))
|
||||
{
|
||||
m->interpol = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (ownerActor->spsmooth.mdoldframe != m->cframe)
|
||||
{
|
||||
if (ownerActor->spsmooth.mdsmooth == 0)
|
||||
{
|
||||
ownerActor->sprext.mdanimtims = mdtims;
|
||||
m->interpol = 0;
|
||||
ownerActor->spsmooth.mdsmooth = 1;
|
||||
ownerActor->spsmooth.mdcurframe = m->cframe;
|
||||
}
|
||||
else if (ownerActor->spsmooth.mdcurframe != m->cframe)
|
||||
{
|
||||
ownerActor->sprext.mdanimtims = mdtims;
|
||||
m->interpol = 0;
|
||||
ownerActor->spsmooth.mdsmooth = 1;
|
||||
ownerActor->spsmooth.mdoldframe = ownerActor->spsmooth.mdcurframe;
|
||||
ownerActor->spsmooth.mdcurframe = m->cframe;
|
||||
}
|
||||
}
|
||||
else // if (ownerActor->spsmooth.mdcurframe != m->cframe)
|
||||
{
|
||||
ownerActor->sprext.mdanimtims = mdtims;
|
||||
m->interpol = 0;
|
||||
ownerActor->spsmooth.mdsmooth = 1;
|
||||
ownerActor->spsmooth.mdoldframe = ownerActor->spsmooth.mdcurframe;
|
||||
ownerActor->spsmooth.mdcurframe = m->cframe;
|
||||
}
|
||||
}
|
||||
else if (/* anim && */ ownerActor->sprext.mdanimcur != anim->startframe)
|
||||
{
|
||||
//if (ownerActor->sprext.flags & SPREXT_NOMDANIM) Printf("SPREXT_NOMDANIM\n");
|
||||
//Printf("smooth launched ! oldanim %i new anim %i\n", ownerActor->sprext.mdanimcur, anim->startframe);
|
||||
ownerActor->sprext.mdanimcur = (int16_t)anim->startframe;
|
||||
ownerActor->sprext.mdanimtims = mdtims;
|
||||
m->interpol = 0;
|
||||
|
||||
if (!smoothdurationp)
|
||||
{
|
||||
m->cframe = m->nframe = anim->startframe;
|
||||
|
||||
goto prep_return;
|
||||
}
|
||||
|
||||
m->nframe = anim->startframe;
|
||||
m->cframe = ownerActor->spsmooth.mdoldframe;
|
||||
|
||||
ownerActor->spsmooth.mdsmooth = 1;
|
||||
goto prep_return;
|
||||
}
|
||||
|
||||
fps = ownerActor->spsmooth.mdsmooth ? xs_CRoundToInt((1.0f / ((float)tile2model[tile].smoothduration * (1.f / (float)UINT16_MAX))) * 66.f)
|
||||
: anim ? anim->fpssc : 1;
|
||||
|
||||
i = (mdtims - ownerActor->sprext.mdanimtims) * ((fps * 120) / 120);
|
||||
|
||||
j = (ownerActor->spsmooth.mdsmooth || !anim) ? 65536 : IntToFixed(anim->endframe + 1 - anim->startframe);
|
||||
|
||||
// XXX: Just in case you play the game for a VERY long time...
|
||||
if (i < 0) { i = 0; ownerActor->sprext.mdanimtims = mdtims; }
|
||||
//compare with j*2 instead of j to ensure i stays > j-65536 for MDANIM_ONESHOT
|
||||
if (anim && (i >= j+j) && (fps) && !mdpause) //Keep mdanimtims close to mdtims to avoid the use of MOD
|
||||
ownerActor->sprext.mdanimtims += j/((fps*120)/120);
|
||||
|
||||
k = i;
|
||||
|
||||
if (anim && (anim->flags&MDANIM_ONESHOT))
|
||||
{ if (i > j-65536) i = j-65536; }
|
||||
else { if (i >= j) { i -= j; if (i >= j) i %= j; } }
|
||||
|
||||
if (hw_animsmoothing && ownerActor->spsmooth.mdsmooth)
|
||||
{
|
||||
m->nframe = anim ? anim->startframe : ownerActor->spsmooth.mdcurframe;
|
||||
m->cframe = ownerActor->spsmooth.mdoldframe;
|
||||
|
||||
//Printf("smoothing... cframe %i nframe %i\n", m->cframe, m->nframe);
|
||||
if (k > 65535)
|
||||
{
|
||||
ownerActor->sprext.mdanimtims = mdtims;
|
||||
m->interpol = 0;
|
||||
ownerActor->spsmooth.mdsmooth = 0;
|
||||
m->cframe = m->nframe; // = anim ? anim->startframe : ownerActor->spsmooth.mdcurframe;
|
||||
|
||||
ownerActor->spsmooth.mdoldframe = m->cframe;
|
||||
//Printf("smooth stopped !\n");
|
||||
goto prep_return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (anim)
|
||||
m->cframe = FixedToInt(i)+anim->startframe;
|
||||
|
||||
|
||||
m->nframe = m->cframe+1;
|
||||
|
||||
if (anim && m->nframe > anim->endframe) // VERIFY: (!(hw_animsmoothing && ownerActor->spsmooth.mdsmooth)) implies (anim!=NULL) ?
|
||||
m->nframe = anim->startframe;
|
||||
|
||||
ownerActor->spsmooth.mdoldframe = m->cframe;
|
||||
}
|
||||
|
||||
m->interpol = clamp(i, 0, 65535) / 65536.f;
|
||||
|
||||
prep_return:
|
||||
if (m->cframe >= m->numframes)
|
||||
m->cframe = 0;
|
||||
if (m->nframe >= m->numframes)
|
||||
m->nframe = 0;
|
||||
}
|
||||
|
||||
//--------------------------------------- MD2 LIBRARY BEGINS ---------------------------------------
|
||||
static md2model_t *md2load(FileReader & fil, const char *filnam)
|
||||
|
|
Loading…
Reference in a new issue