mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-23 12:32:34 +00:00
- Fixed: Using interpolation on drawbar would sometimes result in the last pixel hanging longer than it should.
- Improved draw bar clipping fix from last commit. SVN r4057 (trunk)
This commit is contained in:
parent
b958215b50
commit
5965c45932
2 changed files with 15 additions and 6 deletions
|
@ -1292,10 +1292,10 @@ public:
|
|||
// Check for clipping
|
||||
if(cx != 0 || cy != 0 || cr != 0 || cb != 0)
|
||||
{
|
||||
rcx = cx == 0 ? 0 : rx+(((double) cx/FRACUNIT)*xScale) - texture->GetScaledLeftOffsetDouble();
|
||||
rcy = cy == 0 ? 0 : ry+(((double) cy/FRACUNIT)*yScale) - texture->GetScaledTopOffsetDouble();
|
||||
rcr = cr == 0 ? INT_MAX : rx+w-(((double) cr/FRACUNIT)*xScale) - texture->GetScaledLeftOffsetDouble();
|
||||
rcb = cb == 0 ? INT_MAX : ry+h-(((double) cb/FRACUNIT)*yScale) - texture->GetScaledTopOffsetDouble();
|
||||
rcx = cx == 0 ? 0 : rx+((((double) cx/FRACUNIT) - texture->GetScaledLeftOffsetDouble())*xScale);
|
||||
rcy = cy == 0 ? 0 : ry+((((double) cy/FRACUNIT) - texture->GetScaledTopOffsetDouble())*yScale);
|
||||
rcr = cr == 0 ? INT_MAX : rx+w-((((double) cr/FRACUNIT) + texture->GetScaledLeftOffsetDouble())*xScale);
|
||||
rcb = cb == 0 ? INT_MAX : ry+h-((((double) cb/FRACUNIT) + texture->GetScaledTopOffsetDouble())*yScale);
|
||||
}
|
||||
|
||||
if(clearDontDraw)
|
||||
|
|
|
@ -2330,7 +2330,8 @@ class CommandDrawBar : public SBarInfoCommand
|
|||
public:
|
||||
CommandDrawBar(SBarInfo *script) : SBarInfoCommand(script),
|
||||
border(0), horizontal(false), reverse(false), foreground(-1),
|
||||
background(-1), type(HEALTH), interpolationSpeed(0), drawValue(0)
|
||||
background(-1), type(HEALTH), interpolationSpeed(0), drawValue(0),
|
||||
pixel(-1)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -2649,7 +2650,14 @@ class CommandDrawBar : public SBarInfoCommand
|
|||
value = 0;
|
||||
if(interpolationSpeed != 0 && (!hudChanged || level.time == 1))
|
||||
{
|
||||
if(value < drawValue)
|
||||
// [BL] Since we used a percentage (in order to get the most fluid animation)
|
||||
// we need to establish a cut off point so the last pixel won't hang as the animation slows
|
||||
if(pixel == -1 && statusBar->Images[foreground])
|
||||
pixel = MAX(1, FRACUNIT/statusBar->Images[foreground]->GetWidth());
|
||||
|
||||
if(abs(drawValue - value) < pixel)
|
||||
drawValue = value;
|
||||
else if(value < drawValue)
|
||||
drawValue -= clamp<fixed_t>((drawValue - value) >> 2, 1, FixedDiv(interpolationSpeed<<FRACBITS, FRACUNIT*100));
|
||||
else if(drawValue < value)
|
||||
drawValue += clamp<fixed_t>((value - drawValue) >> 2, 1, FixedDiv(interpolationSpeed<<FRACBITS, FRACUNIT*100));
|
||||
|
@ -2727,6 +2735,7 @@ class CommandDrawBar : public SBarInfoCommand
|
|||
|
||||
int interpolationSpeed;
|
||||
fixed_t drawValue;
|
||||
fixed_t pixel;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Reference in a new issue