mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-29 07:12:36 +00:00
- Fixed: ROLLCENTER was always being applied even when the flag wasn't present.
This commit is contained in:
parent
341c1bbede
commit
fe0de5053a
1 changed files with 11 additions and 9 deletions
|
@ -415,18 +415,13 @@ bool HWSprite::CalculateVertices(HWDrawInfo* di, FVector3* v, DVector3* vp)
|
||||||
const bool useOffsets = (actor != nullptr) && !(actor->renderflags & RF_ROLLCENTER);
|
const bool useOffsets = (actor != nullptr) && !(actor->renderflags & RF_ROLLCENTER);
|
||||||
|
|
||||||
FVector2 offset = FVector2( offx, offy );
|
FVector2 offset = FVector2( offx, offy );
|
||||||
|
float xx = -center.X + x;
|
||||||
// Account for +ROLLCENTER flag. Takes the embedded image offsets and adds them in with SpriteOffsets.
|
float yy = -center.Y + y;
|
||||||
if (drawRollSpriteActor && useOffsets)
|
float zz = -center.Z + z;
|
||||||
{
|
|
||||||
offset.X += center.X - x;
|
|
||||||
offset.Y += center.Z - z;
|
|
||||||
}
|
|
||||||
|
|
||||||
// [Nash] check for special sprite drawing modes
|
// [Nash] check for special sprite drawing modes
|
||||||
if (drawWithXYBillboard || isWallSprite)
|
if (drawWithXYBillboard || isWallSprite)
|
||||||
{
|
{
|
||||||
// Compute center of sprite
|
|
||||||
mat.MakeIdentity();
|
mat.MakeIdentity();
|
||||||
mat.Translate(center.X, center.Z, center.Y); // move to sprite center
|
mat.Translate(center.X, center.Z, center.Y); // move to sprite center
|
||||||
|
|
||||||
|
@ -461,16 +456,21 @@ bool HWSprite::CalculateVertices(HWDrawInfo* di, FVector3* v, DVector3* vp)
|
||||||
mat.Rotate(0, 1, 0, 0);
|
mat.Rotate(0, 1, 0, 0);
|
||||||
if (drawRollSpriteActor)
|
if (drawRollSpriteActor)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if (useOffsets) mat.Translate(xx, zz, yy);
|
||||||
mat.Rotate(yawvecX, 0, yawvecY, rollDegrees);
|
mat.Rotate(yawvecX, 0, yawvecY, rollDegrees);
|
||||||
|
if (useOffsets) mat.Translate(-xx, -zz, -yy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (doRoll)
|
else if (doRoll)
|
||||||
{
|
{
|
||||||
|
if (useOffsets) mat.Translate(xx, zz, yy);
|
||||||
if (drawWithXYBillboard)
|
if (drawWithXYBillboard)
|
||||||
{
|
{
|
||||||
mat.Rotate(-sin(angleRad), 0, cos(angleRad), -HWAngles.Pitch.Degrees());
|
mat.Rotate(-sin(angleRad), 0, cos(angleRad), -HWAngles.Pitch.Degrees());
|
||||||
}
|
}
|
||||||
mat.Rotate(cos(angleRad), 0, sin(angleRad), rollDegrees);
|
mat.Rotate(cos(angleRad), 0, sin(angleRad), rollDegrees);
|
||||||
|
if (useOffsets) mat.Translate(-xx, -zz, -yy);
|
||||||
}
|
}
|
||||||
else if (drawWithXYBillboard)
|
else if (drawWithXYBillboard)
|
||||||
{
|
{
|
||||||
|
@ -503,7 +503,9 @@ bool HWSprite::CalculateVertices(HWDrawInfo* di, FVector3* v, DVector3* vp)
|
||||||
float rollDegrees = Angles.Roll.Degrees();
|
float rollDegrees = Angles.Roll.Degrees();
|
||||||
|
|
||||||
mat.Translate(center.X, center.Z, center.Y);
|
mat.Translate(center.X, center.Z, center.Y);
|
||||||
|
if (useOffsets) mat.Translate(xx, zz, yy);
|
||||||
mat.Rotate(cos(angleRad), 0, sin(angleRad), rollDegrees);
|
mat.Rotate(cos(angleRad), 0, sin(angleRad), rollDegrees);
|
||||||
|
if (useOffsets) mat.Translate(-xx, -zz, -yy);
|
||||||
mat.Translate(-center.X, -center.Z, -center.Y);
|
mat.Translate(-center.X, -center.Z, -center.Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue