Adds pitch/roll script rotation for mdsprites (bug 2783065).

git-svn-id: https://svn.eduke32.com/eduke32@1375 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
plagman 2009-05-10 17:51:00 +00:00
parent 3cd91a1832
commit 77e873b476

View file

@ -3028,7 +3028,28 @@ static void polymer_drawmdsprite(spritetype *tspr)
bglScalef(scale * tspr->xrepeat, scale * tspr->xrepeat, scale * tspr->yrepeat);
bglTranslatef(0.0f, 0.0, m->zadd * 64);
// scripted model rotation
if (spriteext[tspr->owner].pitch || spriteext[tspr->owner].roll)
{
float pitchang, rollang, offsets[3];
pitchang = (float)(spriteext[tspr->owner].pitch) / (2048.0f / 360.0f);
rollang = (float)(spriteext[tspr->owner].roll) / (2048.0f / 360.0f);
offsets[0] = spriteext[tspr->owner].xoff / (scale * tspr->xrepeat);
offsets[1] = spriteext[tspr->owner].yoff / (scale * tspr->xrepeat);
offsets[2] = (float)(spriteext[tspr->owner].zoff) / 16.0f / (scale * tspr->yrepeat);
bglTranslatef(-offsets[0], -offsets[1], -offsets[2]);
bglRotatef(pitchang, 0.0f, 1.0f, 0.0f);
bglRotatef(rollang, -1.0f, 0.0f, 0.0f);
bglTranslatef(offsets[0], offsets[1], offsets[2]);
}
bglGetFloatv(GL_MODELVIEW_MATRIX, spritemodelview);
bglPopMatrix();
bglPushMatrix();
bglMultMatrixf(spritemodelview);