This commit is contained in:
nashmuhandes 2024-03-16 04:37:28 +08:00
commit a72057945b
24 changed files with 65 additions and 579 deletions

View file

@ -466,18 +466,13 @@ bool HWSprite::CalculateVertices(HWDrawInfo* di, FVector3* v, DVector3* vp)
const bool useOffsets = (actor != nullptr) && !(actor->renderflags & RF_ROLLCENTER);
FVector2 offset = FVector2( offx, offy );
// Account for +ROLLCENTER flag. Takes the embedded image offsets and adds them in with SpriteOffsets.
if (drawRollSpriteActor && useOffsets)
{
offset.X += center.X - x;
offset.Y += center.Z - z;
}
float xx = -center.X + x;
float yy = -center.Y + y;
float zz = -center.Z + z;
// [Nash] check for special sprite drawing modes
if (drawWithXYBillboard || isWallSprite)
{
// Compute center of sprite
mat.MakeIdentity();
mat.Translate(center.X, center.Z, center.Y); // move to sprite center
@ -512,16 +507,21 @@ bool HWSprite::CalculateVertices(HWDrawInfo* di, FVector3* v, DVector3* vp)
mat.Rotate(0, 1, 0, 0);
if (drawRollSpriteActor)
{
if (useOffsets) mat.Translate(xx, zz, yy);
mat.Rotate(yawvecX, 0, yawvecY, rollDegrees);
if (useOffsets) mat.Translate(-xx, -zz, -yy);
}
}
else if (doRoll)
{
if (useOffsets) mat.Translate(xx, zz, yy);
if (drawWithXYBillboard)
{
mat.Rotate(-sin(angleRad), 0, cos(angleRad), -HWAngles.Pitch.Degrees());
}
mat.Rotate(cos(angleRad), 0, sin(angleRad), rollDegrees);
if (useOffsets) mat.Translate(-xx, -zz, -yy);
}
else if (drawWithXYBillboard)
{
@ -554,7 +554,9 @@ bool HWSprite::CalculateVertices(HWDrawInfo* di, FVector3* v, DVector3* vp)
float rollDegrees = Angles.Roll.Degrees();
mat.Translate(center.X, center.Z, center.Y);
if (useOffsets) mat.Translate(xx, zz, yy);
mat.Rotate(cos(angleRad), 0, sin(angleRad), rollDegrees);
if (useOffsets) mat.Translate(-xx, -zz, -yy);
mat.Translate(-center.X, -center.Z, -center.Y);
}

View file

@ -598,9 +598,9 @@ void R_InterpolateView(FRenderViewpoint& viewPoint, const player_t* const player
}
else
{
viewPoint.Angles.Pitch = iView->Old.Angles.Pitch * inverseTicFrac + iView->New.Angles.Pitch * ticFrac;
viewPoint.Angles.Yaw = prevYaw * inverseTicFrac + curYaw * ticFrac;
viewPoint.Angles.Roll = iView->Old.Angles.Roll * inverseTicFrac + iView->New.Angles.Roll * ticFrac;
viewPoint.Angles.Pitch = iView->Old.Angles.Pitch + deltaangle(iView->Old.Angles.Pitch, iView->New.Angles.Pitch) * ticFrac;
viewPoint.Angles.Yaw = prevYaw + deltaangle(prevYaw, curYaw) * ticFrac;
viewPoint.Angles.Roll = iView->Old.Angles.Roll + deltaangle(iView->Old.Angles.Roll, iView->New.Angles.Roll) * ticFrac;
}
// Now that the base position and angles are set, add offsets.
@ -624,9 +624,9 @@ void R_InterpolateView(FRenderViewpoint& viewPoint, const player_t* const player
{
if (player == nullptr || (player->cheats & CF_INTERPVIEWANGLES))
{
viewPoint.Angles.Yaw += iView->Old.ViewAngles.Yaw * inverseTicFrac + iView->New.ViewAngles.Yaw * ticFrac;
viewPoint.Angles.Pitch += iView->Old.ViewAngles.Pitch * inverseTicFrac + iView->New.ViewAngles.Pitch * ticFrac;
viewPoint.Angles.Roll += iView->Old.ViewAngles.Roll * inverseTicFrac + iView->New.ViewAngles.Roll * ticFrac;
viewPoint.Angles.Yaw += iView->Old.ViewAngles.Yaw + deltaangle(iView->Old.ViewAngles.Yaw, iView->New.ViewAngles.Yaw) * ticFrac;
viewPoint.Angles.Pitch += iView->Old.ViewAngles.Pitch + deltaangle(iView->Old.ViewAngles.Pitch, iView->New.ViewAngles.Pitch) * ticFrac;
viewPoint.Angles.Roll += iView->Old.ViewAngles.Roll + deltaangle(iView->Old.ViewAngles.Roll, iView->New.ViewAngles.Roll) * ticFrac;
}
else
{