Crappy support for pausing model animations

git-svn-id: https://svn.eduke32.com/eduke32@334 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2006-11-15 01:14:27 +00:00
parent 38e3d16aeb
commit a289704d10

View file

@ -818,12 +818,22 @@ static long mdloadskin (md2model *m, int number, int pal, int surf)
return(*texidx); return(*texidx);
} }
char mdpause;
//Note: even though it says md2model, it works for both md2model&md3model //Note: even though it says md2model, it works for both md2model&md3model
static void updateanimation (md2model *m, spritetype *tspr) static void updateanimation (md2model *m, spritetype *tspr)
{ {
mdanim_t *anim; mdanim_t *anim;
long i, j; long i, j;
if (mdpause)
{
// spriteext[tspr->owner].mdanimtims = mdtims;
m->interpol = 0;
m->nframe = m->cframe;
return;
}
m->cframe = m->nframe = tile2model[tspr->picnum].framenum; m->cframe = m->nframe = tile2model[tspr->picnum].framenum;
for (anim = m->animations; for (anim = m->animations;
@ -841,13 +851,13 @@ if (!anim) { m->interpol = 0; return; }
return; return;
} }
i = (mdtims-spriteext[tspr->owner].mdanimtims)*anim->fpssc*timerticspersec/120; i = (mdtims-spriteext[tspr->owner].mdanimtims)*((anim->fpssc*timerticspersec)/120);
j = ((anim->endframe+1-anim->startframe)<<16); j = ((anim->endframe+1-anim->startframe)<<16);
//Just in case you play the game for a VERY long time... //Just in case you play the game for a VERY long time...
if (i < 0) { i = 0; spriteext[tspr->owner].mdanimtims = mdtims; } if (i < 0) { i = 0; spriteext[tspr->owner].mdanimtims = mdtims; }
//compare with j*2 instead of j to ensure i stays > j-65536 for MDANIM_ONESHOT //compare with j*2 instead of j to ensure i stays > j-65536 for MDANIM_ONESHOT
if ((i >= j+j) && (anim->fpssc)*timerticspersec/120) //Keep mdanimtims close to mdtims to avoid the use of MOD if ((i >= j+j) && (anim->fpssc)) //Keep mdanimtims close to mdtims to avoid the use of MOD
spriteext[tspr->owner].mdanimtims += j/anim->fpssc*timerticspersec/120; spriteext[tspr->owner].mdanimtims += j/((anim->fpssc*timerticspersec)/120);
if (anim->flags&MDANIM_ONESHOT) if (anim->flags&MDANIM_ONESHOT)
{ if (i > j-65536) i = j-65536; } { if (i > j-65536) i = j-65536; }