From bc7b439dd0688897cd26354b4499f096b0a2106f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 16 Jul 2016 09:10:18 +0200 Subject: [PATCH] - addressed: MDL_INHERITACTORPITCH got the direction of the rotation wrong. Fixed by deprecating this flag (and also MDL_INHERITACTORROLL) and introducing proper flags, named MDL_USE*. This not only resolves the issue but also elimintates the nonsensical INHERIT part of the names. --- src/gl/models/gl_models.cpp | 25 +++++++++++++++++++------ src/gl/models/gl_models.h | 3 ++- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/gl/models/gl_models.cpp b/src/gl/models/gl_models.cpp index c2f45ea10..7f05ebb2e 100644 --- a/src/gl/models/gl_models.cpp +++ b/src/gl/models/gl_models.cpp @@ -616,11 +616,19 @@ void gl_InitModels() } else if (sc.Compare("inheritactorpitch")) { - smf.flags |= MDL_INHERITACTORPITCH; + smf.flags |= MDL_USEACTORPITCH | MDL_BADROTATION; } else if (sc.Compare("inheritactorroll")) { - smf.flags |= MDL_INHERITACTORROLL; + smf.flags |= MDL_USEACTORROLL; + } + else if (sc.Compare("useactorpitch")) + { + smf.flags |= MDL_USEACTORPITCH; + } + else if (sc.Compare("useactorroll")) + { + smf.flags |= MDL_USEACTORROLL; } else if (sc.Compare("rotating")) { @@ -961,10 +969,15 @@ void gl_RenderModel(GLSprite * spr) rotateOffset = float((time - xs_FloorToInt(time)) *360.f ); } - // Added MDL_INHERITACTORPITCH and MDL_INHERITACTORROLL flags processing. - // If both flags MDL_INHERITACTORPITCH and MDL_PITCHFROMMOMENTUM are set, the pitch sums up the actor pitch and the momentum vector pitch. - if(smf->flags & MDL_INHERITACTORPITCH) pitch -= spr->actor->Angles.Pitch.Degrees; - if(smf->flags & MDL_INHERITACTORROLL) roll += spr->actor->Angles.Roll.Degrees; + // Added MDL_USEACTORPITCH and MDL_USEACTORROLL flags processing. + // If both flags MDL_USEACTORPITCH and MDL_PITCHFROMMOMENTUM are set, the pitch sums up the actor pitch and the momentum vector pitch. + if (smf->flags & MDL_USEACTORPITCH) + { + double d = spr->actor->Angles.Pitch.Degrees; + if (smf->flags & MDL_BADROTATION) pitch -= d; + else pitch += d; + } + if(smf->flags & MDL_USEACTORROLL) roll += spr->actor->Angles.Roll.Degrees; gl_RenderState.mModelMatrix.loadIdentity(); diff --git a/src/gl/models/gl_models.h b/src/gl/models/gl_models.h index 9ccf765f6..ab53bd7e4 100644 --- a/src/gl/models/gl_models.h +++ b/src/gl/models/gl_models.h @@ -339,7 +339,8 @@ enum MDL_INTERPOLATEDOUBLEDFRAMES = 8, MDL_NOINTERPOLATION = 16, MDL_INHERITACTORPITCH = 32, - MDL_INHERITACTORROLL = 64, // useless for now + MDL_INHERITACTORROLL = 64, + MDL_BADROTATION = 128, }; struct FSpriteModelFrame