Fix math calculation in HUD_DrawBar, rounding float too soon (fix issue #7)

This commit is contained in:
ptitSeb 2019-08-17 12:49:42 +02:00
parent fd2175173a
commit ddf4b42b4c

8
Sources/EntitiesMP/Common/HUD.cpp Normal file → Executable file
View File

@ -519,18 +519,18 @@ static void HUD_DrawBar( FLOAT fCenterX, FLOAT fCenterY, PIX pixSizeX, PIX pixSi
// determine bar position and inner size // determine bar position and inner size
switch( eBarOrientation) { switch( eBarOrientation) {
case BO_UP: case BO_UP:
pixSizeJ *= (PIX) fNormValue; pixSizeJ = (PIX) (pixSizeJ*fNormValue);
break; break;
case BO_DOWN: case BO_DOWN:
pixUpper = pixUpper + (PIX)ceil(pixSizeJ * (1.0f-fNormValue)); pixUpper = pixUpper + (PIX)ceil(pixSizeJ * (1.0f-fNormValue));
pixSizeJ *= (PIX) fNormValue; pixSizeJ = (PIX) (pixSizeJ*fNormValue);
break; break;
case BO_LEFT: case BO_LEFT:
pixSizeI *= (PIX) fNormValue; pixSizeI = (PIX) (pixSizeI*fNormValue);
break; break;
case BO_RIGHT: case BO_RIGHT:
pixLeft = pixLeft + (PIX)ceil(pixSizeI * (1.0f-fNormValue)); pixLeft = pixLeft + (PIX)ceil(pixSizeI * (1.0f-fNormValue));
pixSizeI *= (PIX) fNormValue; pixSizeI = (PIX) (pixSizeI*fNormValue);
break; break;
} }
// done // done