From 77e873b476b1d984fd3039fdfce0702f0938301a Mon Sep 17 00:00:00 2001 From: plagman Date: Sun, 10 May 2009 17:51:00 +0000 Subject: [PATCH] Adds pitch/roll script rotation for mdsprites (bug 2783065). git-svn-id: https://svn.eduke32.com/eduke32@1375 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/src/polymer.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/polymer/eduke32/build/src/polymer.c b/polymer/eduke32/build/src/polymer.c index c52a360a6..4bc68e744 100644 --- a/polymer/eduke32/build/src/polymer.c +++ b/polymer/eduke32/build/src/polymer.c @@ -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);