* Updated to ZDoom 4057:

- Fixed: DrawBar's clipping didn't take the texture offset into account.
- 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.

git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@1513 b0f79afe-0144-0410-b225-9a4edf0717df
This commit is contained in:
gez 2013-02-01 11:51:49 +00:00
parent 6e90487846
commit e492d69c17
3 changed files with 19 additions and 10 deletions

View file

@ -1203,8 +1203,8 @@ public:
h = forceHeight < 0 ? texture->GetScaledHeightDouble() : forceHeight;
double dcx = cx == 0 ? 0 : dx + ((double) cx / FRACUNIT) - texture->GetScaledLeftOffsetDouble();
double dcy = cy == 0 ? 0 : dy + ((double) cy / FRACUNIT) - texture->GetScaledTopOffsetDouble();
double dcr = cr == 0 ? INT_MAX : dx + w - ((double) cr / FRACUNIT);
double dcb = cb == 0 ? INT_MAX : dy + h - ((double) cb / FRACUNIT);
double dcr = cr == 0 ? INT_MAX : dx + w - ((double) cr / FRACUNIT) - texture->GetScaledLeftOffsetDouble();
double dcb = cb == 0 ? INT_MAX : dy + h - ((double) cb / FRACUNIT) - texture->GetScaledTopOffsetDouble();
if(Scaled)
{
@ -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);
rcy = cy == 0 ? 0 : ry+(((double) cy/FRACUNIT)*yScale);
rcr = cr == 0 ? INT_MAX : rx+w-(((double) cr/FRACUNIT)*xScale);
rcb = cb == 0 ? INT_MAX : ry+h-(((double) cb/FRACUNIT)*yScale);
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)

View file

@ -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;
};
////////////////////////////////////////////////////////////////////////////////

View file

@ -3,5 +3,5 @@
// This file was automatically generated by the
// updaterevision tool. Do not edit by hand.
#define ZD_SVN_REVISION_STRING "4055"
#define ZD_SVN_REVISION_NUMBER 4055
#define ZD_SVN_REVISION_STRING "4057"
#define ZD_SVN_REVISION_NUMBER 4057