@@ -2677,22 +2677,19 @@ static Bool computeHealthRegion( const Drawable *draw, IRegion2D& region )
26772677 if (!obj->getHealthBoxDimensions (healthBoxHeight, healthBoxWidth))
26782678 return FALSE ;
26792679
2680- // scale the health bars according to the zoom
2681- Real zoom = TheTacticalView->getZoom ();
2682- // Real widthScale = 1.3f / zoom;
2683- Real widthScale = 1 .0f / zoom;
2684- // Real heightScale = 0.8f / zoom;
2685- Real heightScale = 1 .0f ;
2680+ // scale the health bars according to the zoom and resolution
2681+ Real zoomScale = 1 .0f / TheTacticalView->getZoom ();
26862682
2687- healthBoxWidth *= widthScale;
2688- healthBoxHeight *= heightScale;
2683+ healthBoxWidth *= zoomScale * TheInGameUI->getUnitInfoScaleFactor ();
2684+ // TheSuperHackers @info For now we are integer scaling the health box height
2685+ healthBoxHeight *= floorf (TheDisplay->getHeightScale ());
26892686
2690- // do this so health bar doesn't get too skinny or fat after scaling
2691- // healthBoxHeight = max(3.0f, healthBoxHeight);
2692- healthBoxHeight = 3 . 0f ;
2687+
2688+ // do this so health bar doesn't get too skinny after scaling
2689+ healthBoxHeight = max (defaultHealthBoxHeight, healthBoxHeight) ;
26932690
26942691 // figure out the final region for the health box
2695- region.lo .x = screenCenter.x - healthBoxWidth * 0 .45f ;
2692+ region.lo .x = screenCenter.x - healthBoxWidth * 0 .5f ;
26962693 region.lo .y = screenCenter.y - healthBoxHeight * 0 .5f ;
26972694 region.hi .x = region.lo .x + healthBoxWidth;
26982695 region.hi .y = region.lo .y + healthBoxHeight;
@@ -2829,10 +2826,10 @@ void Drawable::drawEmoticon( const IRegion2D *healthBarRegion )
28292826 if ( healthBarRegion && getIconInfo ()->m_keepTillFrame [ ICON_EMOTICON ] >= now )
28302827 {
28312828 // Draw the emoticon.
2832- Int barWidth = healthBarRegion->hi . x - healthBarRegion-> lo . x ;
2829+ Int barWidth = healthBarRegion->width () ;
28332830 // Int barHeight = healthBarRegion.hi.y - healthBarRegion.lo.y;
2834- Int frameWidth = getIconInfo ()->m_icon [ ICON_EMOTICON ]->getCurrentFrameWidth ();
2835- Int frameHeight = getIconInfo ()->m_icon [ ICON_EMOTICON ]->getCurrentFrameHeight ();
2831+ Int frameWidth = getIconInfo ()->m_icon [ ICON_EMOTICON ]->getCurrentFrameWidth () * TheInGameUI-> getUnitInfoScaleFactor () ;
2832+ Int frameHeight = getIconInfo ()->m_icon [ ICON_EMOTICON ]->getCurrentFrameHeight () * TheInGameUI-> getUnitInfoScaleFactor () ;
28362833
28372834#ifdef SCALE_ICONS_WITH_ZOOM_ML
28382835 // adjust the width to be a % of the health bar region size
@@ -2883,9 +2880,9 @@ void Drawable::drawAmmo( const IRegion2D *healthBarRegion )
28832880 Real scale = 1 .0f ;
28842881#endif
28852882
2886- Int boxWidth = REAL_TO_INT ( s_emptyAmmo->getImageWidth () * scale);
2887- Int boxHeight = REAL_TO_INT ( s_emptyAmmo->getImageHeight () * scale);
2888- const Int SPACING = 1 ;
2883+ Int boxWidth = s_emptyAmmo->getImageWidth () * scale * TheInGameUI-> getUnitInfoScaleFactor ( );
2884+ Int boxHeight = s_emptyAmmo->getImageHeight () * scale * TheInGameUI-> getUnitInfoScaleFactor ( );
2885+ const Real SPACING = 1 . 0f * TheInGameUI-> getUnitInfoScaleFactor () ;
28892886 // Int totalWidth = (boxWidth+SPACING)*numTotal;
28902887
28912888 ICoord2D screenCenter;
@@ -2950,9 +2947,9 @@ void Drawable::drawContained( const IRegion2D *healthBarRegion )
29502947#else
29512948 Real scale = 1 .0f ;
29522949#endif
2953- Int boxWidth = REAL_TO_INT ( s_emptyContainer->getImageWidth () * scale);
2954- Int boxHeight = REAL_TO_INT ( s_emptyContainer->getImageHeight () * scale);
2955- const Int SPACING = 1 ;
2950+ Int boxWidth = s_emptyContainer->getImageWidth () * scale * TheInGameUI-> getUnitInfoScaleFactor ( );
2951+ Int boxHeight = s_emptyContainer->getImageHeight () * scale * TheInGameUI-> getUnitInfoScaleFactor ( );
2952+ const Real SPACING = 1 . 0f * TheInGameUI-> getUnitInfoScaleFactor () ;
29562953 // Int totalWidth = (boxWidth+SPACING)*numTotal;
29572954
29582955 ICoord2D screenCenter;
@@ -3003,8 +3000,8 @@ void Drawable::drawBattlePlans( const IRegion2D *healthBarRegion )
30033000 getIconInfo ()->m_icon [ ICON_BATTLEPLAN_BOMBARD ] = newInstance (Anim2D)( s_animationTemplates[ ICON_BATTLEPLAN_BOMBARD ], TheAnim2DCollection );
30043001 }
30053002 // Int barHeight = healthBarRegion.hi.y - healthBarRegion.lo.y;
3006- Int frameWidth = getIconInfo ()->m_icon [ ICON_BATTLEPLAN_BOMBARD ]->getCurrentFrameWidth ();
3007- Int frameHeight = getIconInfo ()->m_icon [ ICON_BATTLEPLAN_BOMBARD ]->getCurrentFrameHeight ();
3003+ Int frameWidth = getIconInfo ()->m_icon [ ICON_BATTLEPLAN_BOMBARD ]->getCurrentFrameWidth () * TheInGameUI-> getUnitInfoScaleFactor () ;
3004+ Int frameHeight = getIconInfo ()->m_icon [ ICON_BATTLEPLAN_BOMBARD ]->getCurrentFrameHeight () * TheInGameUI-> getUnitInfoScaleFactor () ;
30083005
30093006#ifdef SCALE_ICONS_WITH_ZOOM_ML
30103007 // adjust the width to be a % of the health bar region size
@@ -3031,8 +3028,8 @@ void Drawable::drawBattlePlans( const IRegion2D *healthBarRegion )
30313028 getIconInfo ()->m_icon [ ICON_BATTLEPLAN_HOLDTHELINE ] = newInstance (Anim2D)( s_animationTemplates[ ICON_BATTLEPLAN_HOLDTHELINE ], TheAnim2DCollection );
30323029 }
30333030 // draw the icon
3034- Int frameWidth = getIconInfo ()->m_icon [ ICON_BATTLEPLAN_HOLDTHELINE ]->getCurrentFrameWidth ();
3035- Int frameHeight = getIconInfo ()->m_icon [ ICON_BATTLEPLAN_HOLDTHELINE ]->getCurrentFrameHeight ();
3031+ Int frameWidth = getIconInfo ()->m_icon [ ICON_BATTLEPLAN_HOLDTHELINE ]->getCurrentFrameWidth () * TheInGameUI-> getUnitInfoScaleFactor () ;
3032+ Int frameHeight = getIconInfo ()->m_icon [ ICON_BATTLEPLAN_HOLDTHELINE ]->getCurrentFrameHeight () * TheInGameUI-> getUnitInfoScaleFactor () ;
30363033
30373034#ifdef SCALE_ICONS_WITH_ZOOM_ML
30383035 // adjust the width to be a % of the health bar region size
@@ -3059,8 +3056,8 @@ void Drawable::drawBattlePlans( const IRegion2D *healthBarRegion )
30593056 getIconInfo ()->m_icon [ ICON_BATTLEPLAN_SEARCHANDDESTROY ] = newInstance (Anim2D)( s_animationTemplates[ ICON_BATTLEPLAN_SEARCHANDDESTROY ], TheAnim2DCollection );
30603057 }
30613058 // draw the icon
3062- Int frameWidth = getIconInfo ()->m_icon [ ICON_BATTLEPLAN_SEARCHANDDESTROY ]->getCurrentFrameWidth ();
3063- Int frameHeight = getIconInfo ()->m_icon [ ICON_BATTLEPLAN_SEARCHANDDESTROY ]->getCurrentFrameHeight ();
3059+ Int frameWidth = getIconInfo ()->m_icon [ ICON_BATTLEPLAN_SEARCHANDDESTROY ]->getCurrentFrameWidth () * TheInGameUI-> getUnitInfoScaleFactor () ;
3060+ Int frameHeight = getIconInfo ()->m_icon [ ICON_BATTLEPLAN_SEARCHANDDESTROY ]->getCurrentFrameHeight () * TheInGameUI-> getUnitInfoScaleFactor () ;
30643061
30653062#ifdef SCALE_ICONS_WITH_ZOOM_ML
30663063 // adjust the width to be a % of the health bar region size
@@ -3271,10 +3268,10 @@ void Drawable::drawHealing(const IRegion2D* healthBarRegion)
32713268 // we are going to draw the healing icon relative to the size of the health bar region
32723269 // since that region takes into account hit point size and zoom factor of the camera too
32733270 //
3274- Int barWidth = healthBarRegion->hi . x - healthBarRegion-> lo . x ;
3271+ Int barWidth = healthBarRegion->width () ;
32753272
3276- Int frameWidth = getIconInfo ()->m_icon [ typeIndex ]->getCurrentFrameWidth ();
3277- Int frameHeight = getIconInfo ()->m_icon [ typeIndex ]->getCurrentFrameHeight ();
3273+ Int frameWidth = getIconInfo ()->m_icon [ typeIndex ]->getCurrentFrameWidth () * TheInGameUI-> getUnitInfoScaleFactor () ;
3274+ Int frameHeight = getIconInfo ()->m_icon [ typeIndex ]->getCurrentFrameHeight () * TheInGameUI-> getUnitInfoScaleFactor () ;
32783275
32793276#ifdef SCALE_ICONS_WITH_ZOOM_ML
32803277 // adjust the width to be a % of the health bar region size
@@ -3334,7 +3331,7 @@ void Drawable::drawEnthusiastic(const IRegion2D* healthBarRegion)
33343331 // we are going to draw the healing icon relative to the size of the health bar region
33353332 // since that region takes into account hit point size and zoom factor of the camera too
33363333 //
3337- Int barWidth = healthBarRegion->hi . x - healthBarRegion-> lo . x ;// used for position
3334+ Int barWidth = healthBarRegion->width () ;// used for position
33383335
33393336 // based on our own kind of we have certain icons to display at a size scale
33403337 Real scale;
@@ -3345,8 +3342,8 @@ void Drawable::drawEnthusiastic(const IRegion2D* healthBarRegion)
33453342 else
33463343 scale = 0 .5f ;
33473344
3348- Int frameWidth = getIconInfo ()->m_icon [ iconIndex ]->getCurrentFrameWidth () * scale;
3349- Int frameHeight = getIconInfo ()->m_icon [ iconIndex ]->getCurrentFrameHeight () * scale;
3345+ Int frameWidth = getIconInfo ()->m_icon [ iconIndex ]->getCurrentFrameWidth () * scale * TheInGameUI-> getUnitInfoScaleFactor () ;
3346+ Int frameHeight = getIconInfo ()->m_icon [ iconIndex ]->getCurrentFrameHeight () * scale * TheInGameUI-> getUnitInfoScaleFactor () ;
33503347
33513348#ifdef SCALE_ICONS_WITH_ZOOM_ML
33523349 // adjust the width to be a % of the health bar region size
@@ -3635,10 +3632,10 @@ void Drawable::drawDisabled(const IRegion2D* healthBarRegion)
36353632 // draw the icon
36363633 if ( healthBarRegion )
36373634 {
3638- Int barHeight = healthBarRegion->hi . y - healthBarRegion-> lo . y ;
3635+ Int barHeight = healthBarRegion->height () ;
36393636
3640- Int frameWidth = getIconInfo ()->m_icon [ ICON_DISABLED ]->getCurrentFrameWidth ();
3641- Int frameHeight = getIconInfo ()->m_icon [ ICON_DISABLED ]->getCurrentFrameHeight ();
3637+ Int frameWidth = getIconInfo ()->m_icon [ ICON_DISABLED ]->getCurrentFrameWidth () * TheInGameUI-> getUnitInfoScaleFactor () ;
3638+ Int frameHeight = getIconInfo ()->m_icon [ ICON_DISABLED ]->getCurrentFrameHeight () * TheInGameUI-> getUnitInfoScaleFactor () ;
36423639
36433640#ifdef SCALE_ICONS_WITH_ZOOM_ML
36443641 // adjust the width to be a % of the health bar region size
@@ -3784,19 +3781,19 @@ void Drawable::drawVeterancy( const IRegion2D *healthBarRegion )
37843781 if (!image)
37853782 return ;
37863783
3787- Real scale = 1 .3f /CLAMP_ICON_ZOOM_FACTOR ( TheTacticalView->getZoom () );
37883784#ifdef SCALE_ICONS_WITH_ZOOM_ML
3785+ Real scale = 1 .3f /CLAMP_ICON_ZOOM_FACTOR ( TheTacticalView->getZoom () );
37893786 Real objScale = scale * 1 .55f ;
37903787#else
37913788 Real objScale = 1 .0f ;
37923789#endif
37933790
37943791
3795- Real vetBoxWidth = image->getImageWidth ()* objScale;
3796- Real vetBoxHeight = image->getImageHeight ()* objScale;
3792+ Real vetBoxWidth = image->getImageWidth () * objScale * TheInGameUI-> getUnitInfoScaleFactor () ;
3793+ Real vetBoxHeight = image->getImageHeight () * objScale * TheInGameUI-> getUnitInfoScaleFactor () ;
37973794
37983795 //
3799- // take the center position of the object , go down to it's bottom extent, and project
3796+ // take the center position of the health region , go down to it's bottom extent, and project
38003797 // that point to the screen, that will be the "center" of our veterancy box
38013798 //
38023799
@@ -3806,11 +3803,7 @@ void Drawable::drawVeterancy( const IRegion2D *healthBarRegion )
38063803 if ( !TheTacticalView->worldToScreen ( &p, &screenCenter ) )
38073804 return ;
38083805
3809- Real healthBoxWidth, healthBoxHeight;
3810- if (!obj->getHealthBoxDimensions (healthBoxHeight, healthBoxWidth))
3811- return ;
3812-
3813- screenCenter.x += healthBoxWidth * scale * 0 .5f ;
3806+ screenCenter.x += healthBarRegion->width () * 0 .65f ;
38143807
38153808 // draw the image
38163809 TheDisplay->drawImage (image, screenCenter.x + 1 , screenCenter.y + 1 , screenCenter.x + 1 + vetBoxWidth, screenCenter.y + 1 + vetBoxHeight);
@@ -3918,23 +3911,24 @@ void Drawable::drawHealthBar(const IRegion2D* healthBarRegion)
39183911
39193912 }
39203913
3914+ Real healthBoxWidth = healthBarRegion->width ();
3915+ Real healthBoxHeight = max ((Int)defaultHealthBoxHeight, healthBarRegion->height ());
3916+ // TheSuperHackers @info For now we are integer scaling the health box height so we do the same for the health box outline
3917+ Real healthBoxOutlineSize = floorf ( (healthBarRegion->height () / (Int)defaultHealthBoxHeight) );
39213918
3922-
3923-
3924- // / Real scale = 1.3f / TheTacticalView->getZoom();
3925- Real healthBoxWidth = healthBarRegion->hi .x - healthBarRegion->lo .x ;
3926-
3927- Real healthBoxHeight = max (3 , healthBarRegion->hi .y - healthBarRegion->lo .y );
3928- Real healthBoxOutlineSize = 1 .0f ;
3919+ // draw a filled bar for the health
3920+ // TheSuperHackers @info this takes up the whole size of the health rect area, the border is drawn over the top
3921+ // This simplifies the handling of the health bar
3922+ TheDisplay->drawFillRect ( healthBarRegion->lo .x , healthBarRegion->lo .y ,
3923+ healthBoxWidth * healthRatio, healthBoxHeight,
3924+ color );
39293925
39303926 // draw the health box outline
3931- TheDisplay->drawOpenRect ( healthBarRegion->lo .x , healthBarRegion->lo .y , healthBoxWidth, healthBoxHeight,
3927+ // TheSuperHackers @info when drawing the outline, the underlying function grows the outline towards the center of the region
3928+ TheDisplay->drawOpenRect ( healthBarRegion->lo .x , healthBarRegion->lo .y ,
3929+ healthBoxWidth, healthBoxHeight,
39323930 healthBoxOutlineSize, outlineColor );
39333931
3934- // draw a filled bar for the health
3935- TheDisplay->drawFillRect ( healthBarRegion->lo .x + 1 , healthBarRegion->lo .y + 1 ,
3936- (healthBoxWidth - 2 ) * healthRatio, healthBoxHeight - 2 ,
3937- color );
39383932 }
39393933
39403934}
0 commit comments