Fixes multiple models per sprite in colourized sectors (it was using tspr palette instead of the actual sprite palette). (hunter_rus)

git-svn-id: https://svn.eduke32.com/eduke32@597 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
plagman 2008-01-06 21:41:47 +00:00
parent 993fce0352
commit 42f025e364

View file

@ -1045,7 +1045,7 @@ static void updateanimation(md2model *m, spritetype *tspr)
int i, j, k; int i, j, k;
int fps; int fps;
m->cframe = m->nframe = tile2model[Ptile2tile(tspr->picnum,tspr->pal)].framenum; m->cframe = m->nframe = tile2model[Ptile2tile(tspr->picnum,sprite[tspr->owner].pal)].framenum;
if (mdpause) if (mdpause)
{ {
// spriteext[tspr->owner].mdanimtims = mdtims; // spriteext[tspr->owner].mdanimtims = mdtims;
@ -1060,7 +1060,7 @@ static void updateanimation(md2model *m, spritetype *tspr)
anim = anim->next) ; anim = anim->next) ;
if (!anim) if (!anim)
{ {
if (r_animsmoothing && (tile2model[Ptile2tile(tspr->picnum,tspr->pal)].smoothduration != 0) && (spritesmooth[tspr->owner].mdoldframe != m->cframe)) if (r_animsmoothing && (tile2model[Ptile2tile(tspr->picnum,sprite[tspr->owner].pal)].smoothduration != 0) && (spritesmooth[tspr->owner].mdoldframe != m->cframe))
{ {
if (spritesmooth[tspr->owner].mdsmooth == 0) if (spritesmooth[tspr->owner].mdsmooth == 0)
{ {
@ -1069,7 +1069,7 @@ static void updateanimation(md2model *m, spritetype *tspr)
spritesmooth[tspr->owner].mdsmooth = 1; spritesmooth[tspr->owner].mdsmooth = 1;
spritesmooth[tspr->owner].mdcurframe = m->cframe; spritesmooth[tspr->owner].mdcurframe = m->cframe;
} }
if (r_animsmoothing && (tile2model[Ptile2tile(tspr->picnum,tspr->pal)].smoothduration != 0) && (spritesmooth[tspr->owner].mdcurframe != m->cframe)) if (r_animsmoothing && (tile2model[Ptile2tile(tspr->picnum,sprite[tspr->owner].pal)].smoothduration != 0) && (spritesmooth[tspr->owner].mdcurframe != m->cframe))
{ {
spriteext[tspr->owner].mdanimtims = mdtims; spriteext[tspr->owner].mdanimtims = mdtims;
m->interpol = 0; m->interpol = 0;
@ -1078,7 +1078,7 @@ static void updateanimation(md2model *m, spritetype *tspr)
spritesmooth[tspr->owner].mdcurframe = m->cframe; spritesmooth[tspr->owner].mdcurframe = m->cframe;
} }
} }
else if (r_animsmoothing && (tile2model[Ptile2tile(tspr->picnum,tspr->pal)].smoothduration != 0) && (spritesmooth[tspr->owner].mdcurframe != m->cframe)) else if (r_animsmoothing && (tile2model[Ptile2tile(tspr->picnum,sprite[tspr->owner].pal)].smoothduration != 0) && (spritesmooth[tspr->owner].mdcurframe != m->cframe))
{ {
spriteext[tspr->owner].mdanimtims = mdtims; spriteext[tspr->owner].mdanimtims = mdtims;
m->interpol = 0; m->interpol = 0;
@ -1100,7 +1100,7 @@ static void updateanimation(md2model *m, spritetype *tspr)
spriteext[tspr->owner].mdanimcur = (short)anim->startframe; spriteext[tspr->owner].mdanimcur = (short)anim->startframe;
spriteext[tspr->owner].mdanimtims = mdtims; spriteext[tspr->owner].mdanimtims = mdtims;
m->interpol = 0; m->interpol = 0;
if (!r_animsmoothing || (tile2model[Ptile2tile(tspr->picnum,tspr->pal)].smoothduration == 0)) if (!r_animsmoothing || (tile2model[Ptile2tile(tspr->picnum,sprite[tspr->owner].pal)].smoothduration == 0))
{ {
m->cframe = m->nframe = anim->startframe; m->cframe = m->nframe = anim->startframe;
return; return;
@ -1112,7 +1112,7 @@ static void updateanimation(md2model *m, spritetype *tspr)
} }
if (spritesmooth[tspr->owner].mdsmooth) if (spritesmooth[tspr->owner].mdsmooth)
fps = (1.0f / (float)(tile2model[Ptile2tile(tspr->picnum,tspr->pal)].smoothduration)) * 66; fps = (1.0f / (float)(tile2model[Ptile2tile(tspr->picnum,sprite[tspr->owner].pal)].smoothduration)) * 66;
else else
fps = anim->fpssc; fps = anim->fpssc;
@ -1865,14 +1865,14 @@ static int md3draw(md3model *m, spritetype *tspr)
// PLAG: End // PLAG: End
for (pal1=SPECPAL;pal1<=REDPAL;pal1++) for (pal1=SPECPAL;pal1<=REDPAL;pal1++)
mdloadskin((md2model *)m,tile2model[Ptile2tile(tspr->picnum,tspr->pal)].skinnum,pal1,surfi); mdloadskin((md2model *)m,tile2model[Ptile2tile(tspr->picnum,sprite[tspr->owner].pal)].skinnum,pal1,surfi);
i = mdloadskin((md2model *)m,tile2model[Ptile2tile(tspr->picnum,tspr->pal)].skinnum,globalpal,surfi); if (!i) continue; i = mdloadskin((md2model *)m,tile2model[Ptile2tile(tspr->picnum,sprite[tspr->owner].pal)].skinnum,globalpal,surfi); if (!i) continue;
//i = mdloadskin((md2model *)m,tile2model[Ptile2tile(tspr->picnum,tspr->pal)].skinnum,surfi); //hack for testing multiple surfaces per MD3 //i = mdloadskin((md2model *)m,tile2model[Ptile2tile(tspr->picnum,sprite[tspr->owner].pal)].skinnum,surfi); //hack for testing multiple surfaces per MD3
bglBindTexture(GL_TEXTURE_2D, i); bglBindTexture(GL_TEXTURE_2D, i);
if (r_detailmapping && !r_depthpeeling && !(tspr->cstat&1024)) if (r_detailmapping && !r_depthpeeling && !(tspr->cstat&1024))
i = mdloadskin((md2model *)m,tile2model[Ptile2tile(tspr->picnum,tspr->pal)].skinnum,DETAILPAL,surfi); i = mdloadskin((md2model *)m,tile2model[Ptile2tile(tspr->picnum,sprite[tspr->owner].pal)].skinnum,DETAILPAL,surfi);
else else
i = 0; i = 0;
@ -1902,7 +1902,7 @@ static int md3draw(md3model *m, spritetype *tspr)
bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT); bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT);
for (sk = m->skinmap; sk; sk = sk->next) for (sk = m->skinmap; sk; sk = sk->next)
if ((int)sk->palette == DETAILPAL && sk->skinnum == tile2model[Ptile2tile(tspr->picnum,tspr->pal)].skinnum && sk->surfnum == surfi) if ((int)sk->palette == DETAILPAL && sk->skinnum == tile2model[Ptile2tile(tspr->picnum,sprite[tspr->owner].pal)].skinnum && sk->surfnum == surfi)
f = sk->param; f = sk->param;
bglMatrixMode(GL_TEXTURE); bglMatrixMode(GL_TEXTURE);
@ -1912,7 +1912,7 @@ static int md3draw(md3model *m, spritetype *tspr)
} }
if (r_glowmapping && !r_depthpeeling && !(tspr->cstat&1024)) if (r_glowmapping && !r_depthpeeling && !(tspr->cstat&1024))
i = mdloadskin((md2model *)m,tile2model[Ptile2tile(tspr->picnum,tspr->pal)].skinnum,GLOWPAL,surfi); i = mdloadskin((md2model *)m,tile2model[Ptile2tile(tspr->picnum,sprite[tspr->owner].pal)].skinnum,GLOWPAL,surfi);
else else
i = 0; i = 0;
@ -3058,7 +3058,7 @@ int mddraw(spritetype *tspr)
allocmodelverts = maxmodelverts; allocmodelverts = maxmodelverts;
} }
vm = models[tile2model[Ptile2tile(tspr->picnum,tspr->pal)].modelid]; vm = models[tile2model[Ptile2tile(tspr->picnum,sprite[tspr->owner].pal)].modelid];
if (vm->mdnum == 1) { return voxdraw((voxmodel *)vm,tspr); } if (vm->mdnum == 1) { return voxdraw((voxmodel *)vm,tspr); }
if (vm->mdnum == 3) { return md3draw((md3model *)vm,tspr); } if (vm->mdnum == 3) { return md3draw((md3model *)vm,tspr); }
return 0; return 0;