@@ -2683,22 +2683,21 @@ static Bool computeHealthRegion( const Drawable *draw, IRegion2D& region )
26832683 if (!obj->getHealthBoxDimensions (healthBoxHeight, healthBoxWidth))
26842684 return FALSE ;
26852685
2686- // scale the health bars according to the zoom
2687- Real zoom = TheTacticalView->getZoom ();
2688- // Real widthScale = 1.3f / zoom;
2689- Real widthScale = 1 .0f / zoom;
2690- // Real heightScale = 0.8f / zoom;
2691- Real heightScale = 1 .0f ;
2686+ // scale the health bars according to the zoom and resolution
2687+ // TheSuperHacker @info Original zoom at default height had a value of ~1.35
2688+ // Recent changes rebased the zoom to be 1.0 at default height, therefore 1.0 / 1.35 = ~0.74
2689+ Real zoomScale = 0 .74f / TheTacticalView->getZoom ();
26922690
2693- healthBoxWidth *= widthScale;
2694- healthBoxHeight *= heightScale;
2691+ healthBoxWidth *= zoomScale * TheInGameUI->getUnitInfoScaleFactor ();
2692+ // TheSuperHackers @info For now we are integer scaling the health box height
2693+ healthBoxHeight *= floorf (TheDisplay->getHeightScale ());
26952694
2696- // do this so health bar doesn't get too skinny or fat after scaling
2697- // healthBoxHeight = max(3.0f, healthBoxHeight);
2698- healthBoxHeight = 3 . 0f ;
2695+
2696+ // do this so health bar doesn't get too skinny after scaling
2697+ healthBoxHeight = max (defaultHealthBoxHeight, healthBoxHeight) ;
26992698
27002699 // figure out the final region for the health box
2701- region.lo .x = screenCenter.x - healthBoxWidth * 0 .45f ;
2700+ region.lo .x = screenCenter.x - healthBoxWidth * 0 .5f ;
27022701 region.lo .y = screenCenter.y - healthBoxHeight * 0 .5f ;
27032702 region.hi .x = region.lo .x + healthBoxWidth;
27042703 region.hi .y = region.lo .y + healthBoxHeight;
@@ -2831,10 +2830,10 @@ void Drawable::drawEmoticon( const IRegion2D *healthBarRegion )
28312830 if ( healthBarRegion && getIconInfo ()->m_keepTillFrame [ ICON_EMOTICON ] >= now )
28322831 {
28332832 // Draw the emoticon.
2834- Int barWidth = healthBarRegion->hi . x - healthBarRegion-> lo . x ;
2833+ Int barWidth = healthBarRegion->width () ;
28352834 // Int barHeight = healthBarRegion.hi.y - healthBarRegion.lo.y;
2836- Int frameWidth = getIconInfo ()->m_icon [ ICON_EMOTICON ]->getCurrentFrameWidth ();
2837- Int frameHeight = getIconInfo ()->m_icon [ ICON_EMOTICON ]->getCurrentFrameHeight ();
2835+ Int frameWidth = getIconInfo ()->m_icon [ ICON_EMOTICON ]->getCurrentFrameWidth () * TheInGameUI-> getUnitInfoScaleFactor () ;
2836+ Int frameHeight = getIconInfo ()->m_icon [ ICON_EMOTICON ]->getCurrentFrameHeight () * TheInGameUI-> getUnitInfoScaleFactor () ;
28382837
28392838#ifdef SCALE_ICONS_WITH_ZOOM_ML
28402839 // adjust the width to be a % of the health bar region size
@@ -2885,9 +2884,9 @@ void Drawable::drawAmmo( const IRegion2D *healthBarRegion )
28852884 Real scale = 1 .0f ;
28862885#endif
28872886
2888- Int boxWidth = REAL_TO_INT ( s_emptyAmmo->getImageWidth () * scale);
2889- Int boxHeight = REAL_TO_INT ( s_emptyAmmo->getImageHeight () * scale);
2890- const Int SPACING = 1 ;
2887+ Int boxWidth = s_emptyAmmo->getImageWidth () * scale * TheInGameUI-> getUnitInfoScaleFactor ( );
2888+ Int boxHeight = s_emptyAmmo->getImageHeight () * scale * TheInGameUI-> getUnitInfoScaleFactor ( );
2889+ const Real SPACING = 1 . 0f * TheInGameUI-> getUnitInfoScaleFactor () ;
28912890 // Int totalWidth = (boxWidth+SPACING)*numTotal;
28922891
28932892 ICoord2D screenCenter;
@@ -2952,9 +2951,9 @@ void Drawable::drawContained( const IRegion2D *healthBarRegion )
29522951#else
29532952 Real scale = 1 .0f ;
29542953#endif
2955- Int boxWidth = REAL_TO_INT ( s_emptyContainer->getImageWidth () * scale);
2956- Int boxHeight = REAL_TO_INT ( s_emptyContainer->getImageHeight () * scale);
2957- const Int SPACING = 1 ;
2954+ Int boxWidth = s_emptyContainer->getImageWidth () * scale * TheInGameUI-> getUnitInfoScaleFactor ( );
2955+ Int boxHeight = s_emptyContainer->getImageHeight () * scale * TheInGameUI-> getUnitInfoScaleFactor ( );
2956+ const Real SPACING = 1 . 0f * TheInGameUI-> getUnitInfoScaleFactor () ;
29582957 // Int totalWidth = (boxWidth+SPACING)*numTotal;
29592958
29602959 ICoord2D screenCenter;
@@ -3005,8 +3004,8 @@ void Drawable::drawBattlePlans( const IRegion2D *healthBarRegion )
30053004 getIconInfo ()->m_icon [ ICON_BATTLEPLAN_BOMBARD ] = newInstance (Anim2D)( s_animationTemplates[ ICON_BATTLEPLAN_BOMBARD ], TheAnim2DCollection );
30063005 }
30073006 // Int barHeight = healthBarRegion.hi.y - healthBarRegion.lo.y;
3008- Int frameWidth = getIconInfo ()->m_icon [ ICON_BATTLEPLAN_BOMBARD ]->getCurrentFrameWidth ();
3009- Int frameHeight = getIconInfo ()->m_icon [ ICON_BATTLEPLAN_BOMBARD ]->getCurrentFrameHeight ();
3007+ Int frameWidth = getIconInfo ()->m_icon [ ICON_BATTLEPLAN_BOMBARD ]->getCurrentFrameWidth () * TheInGameUI-> getUnitInfoScaleFactor () ;
3008+ Int frameHeight = getIconInfo ()->m_icon [ ICON_BATTLEPLAN_BOMBARD ]->getCurrentFrameHeight () * TheInGameUI-> getUnitInfoScaleFactor () ;
30103009
30113010#ifdef SCALE_ICONS_WITH_ZOOM_ML
30123011 // adjust the width to be a % of the health bar region size
@@ -3033,8 +3032,8 @@ void Drawable::drawBattlePlans( const IRegion2D *healthBarRegion )
30333032 getIconInfo ()->m_icon [ ICON_BATTLEPLAN_HOLDTHELINE ] = newInstance (Anim2D)( s_animationTemplates[ ICON_BATTLEPLAN_HOLDTHELINE ], TheAnim2DCollection );
30343033 }
30353034 // draw the icon
3036- Int frameWidth = getIconInfo ()->m_icon [ ICON_BATTLEPLAN_HOLDTHELINE ]->getCurrentFrameWidth ();
3037- Int frameHeight = getIconInfo ()->m_icon [ ICON_BATTLEPLAN_HOLDTHELINE ]->getCurrentFrameHeight ();
3035+ Int frameWidth = getIconInfo ()->m_icon [ ICON_BATTLEPLAN_HOLDTHELINE ]->getCurrentFrameWidth () * TheInGameUI-> getUnitInfoScaleFactor () ;
3036+ Int frameHeight = getIconInfo ()->m_icon [ ICON_BATTLEPLAN_HOLDTHELINE ]->getCurrentFrameHeight () * TheInGameUI-> getUnitInfoScaleFactor () ;
30383037
30393038#ifdef SCALE_ICONS_WITH_ZOOM_ML
30403039 // adjust the width to be a % of the health bar region size
@@ -3061,8 +3060,8 @@ void Drawable::drawBattlePlans( const IRegion2D *healthBarRegion )
30613060 getIconInfo ()->m_icon [ ICON_BATTLEPLAN_SEARCHANDDESTROY ] = newInstance (Anim2D)( s_animationTemplates[ ICON_BATTLEPLAN_SEARCHANDDESTROY ], TheAnim2DCollection );
30623061 }
30633062 // draw the icon
3064- Int frameWidth = getIconInfo ()->m_icon [ ICON_BATTLEPLAN_SEARCHANDDESTROY ]->getCurrentFrameWidth ();
3065- Int frameHeight = getIconInfo ()->m_icon [ ICON_BATTLEPLAN_SEARCHANDDESTROY ]->getCurrentFrameHeight ();
3063+ Int frameWidth = getIconInfo ()->m_icon [ ICON_BATTLEPLAN_SEARCHANDDESTROY ]->getCurrentFrameWidth () * TheInGameUI-> getUnitInfoScaleFactor () ;
3064+ Int frameHeight = getIconInfo ()->m_icon [ ICON_BATTLEPLAN_SEARCHANDDESTROY ]->getCurrentFrameHeight () * TheInGameUI-> getUnitInfoScaleFactor () ;
30663065
30673066#ifdef SCALE_ICONS_WITH_ZOOM_ML
30683067 // adjust the width to be a % of the health bar region size
@@ -3231,10 +3230,10 @@ void Drawable::drawHealing(const IRegion2D* healthBarRegion)
32313230 // we are going to draw the healing icon relative to the size of the health bar region
32323231 // since that region takes into account hit point size and zoom factor of the camera too
32333232 //
3234- Int barWidth = healthBarRegion->hi . x - healthBarRegion-> lo . x ;
3233+ Int barWidth = healthBarRegion->width () ;
32353234
3236- Int frameWidth = getIconInfo ()->m_icon [ typeIndex ]->getCurrentFrameWidth ();
3237- Int frameHeight = getIconInfo ()->m_icon [ typeIndex ]->getCurrentFrameHeight ();
3235+ Int frameWidth = getIconInfo ()->m_icon [ typeIndex ]->getCurrentFrameWidth () * TheInGameUI-> getUnitInfoScaleFactor () ;
3236+ Int frameHeight = getIconInfo ()->m_icon [ typeIndex ]->getCurrentFrameHeight () * TheInGameUI-> getUnitInfoScaleFactor () ;
32383237
32393238#ifdef SCALE_ICONS_WITH_ZOOM_ML
32403239 // adjust the width to be a % of the health bar region size
@@ -3294,7 +3293,7 @@ void Drawable::drawEnthusiastic(const IRegion2D* healthBarRegion)
32943293 // we are going to draw the healing icon relative to the size of the health bar region
32953294 // since that region takes into account hit point size and zoom factor of the camera too
32963295 //
3297- Int barWidth = healthBarRegion->hi . x - healthBarRegion-> lo . x ;// used for position
3296+ Int barWidth = healthBarRegion->width () ;// used for position
32983297
32993298 // based on our own kind of we have certain icons to display at a size scale
33003299 Real scale;
@@ -3305,8 +3304,8 @@ void Drawable::drawEnthusiastic(const IRegion2D* healthBarRegion)
33053304 else
33063305 scale = 0 .5f ;
33073306
3308- Int frameWidth = getIconInfo ()->m_icon [ iconIndex ]->getCurrentFrameWidth () * scale;
3309- Int frameHeight = getIconInfo ()->m_icon [ iconIndex ]->getCurrentFrameHeight () * scale;
3307+ Int frameWidth = getIconInfo ()->m_icon [ iconIndex ]->getCurrentFrameWidth () * scale * TheInGameUI-> getUnitInfoScaleFactor () ;
3308+ Int frameHeight = getIconInfo ()->m_icon [ iconIndex ]->getCurrentFrameHeight () * scale * TheInGameUI-> getUnitInfoScaleFactor () ;
33103309
33113310#ifdef SCALE_ICONS_WITH_ZOOM_ML
33123311 // adjust the width to be a % of the health bar region size
@@ -3595,10 +3594,10 @@ void Drawable::drawDisabled(const IRegion2D* healthBarRegion)
35953594 // draw the icon
35963595 if ( healthBarRegion )
35973596 {
3598- Int barHeight = healthBarRegion->hi . y - healthBarRegion-> lo . y ;
3597+ Int barHeight = healthBarRegion->height () ;
35993598
3600- Int frameWidth = getIconInfo ()->m_icon [ ICON_DISABLED ]->getCurrentFrameWidth ();
3601- Int frameHeight = getIconInfo ()->m_icon [ ICON_DISABLED ]->getCurrentFrameHeight ();
3599+ Int frameWidth = getIconInfo ()->m_icon [ ICON_DISABLED ]->getCurrentFrameWidth () * TheInGameUI-> getUnitInfoScaleFactor () ;
3600+ Int frameHeight = getIconInfo ()->m_icon [ ICON_DISABLED ]->getCurrentFrameHeight () * TheInGameUI-> getUnitInfoScaleFactor () ;
36023601
36033602#ifdef SCALE_ICONS_WITH_ZOOM_ML
36043603 // adjust the width to be a % of the health bar region size
@@ -3744,19 +3743,19 @@ void Drawable::drawVeterancy( const IRegion2D *healthBarRegion )
37443743 if (!image)
37453744 return ;
37463745
3747- Real scale = 1 .3f /CLAMP_ICON_ZOOM_FACTOR ( TheTacticalView->getZoom () );
37483746#ifdef SCALE_ICONS_WITH_ZOOM_ML
3747+ Real scale = 1 .3f /CLAMP_ICON_ZOOM_FACTOR ( TheTacticalView->getZoom () );
37493748 Real objScale = scale * 1 .55f ;
37503749#else
37513750 Real objScale = 1 .0f ;
37523751#endif
37533752
37543753
3755- Real vetBoxWidth = image->getImageWidth ()* objScale;
3756- Real vetBoxHeight = image->getImageHeight ()* objScale;
3754+ Real vetBoxWidth = image->getImageWidth () * objScale * TheInGameUI-> getUnitInfoScaleFactor () ;
3755+ Real vetBoxHeight = image->getImageHeight () * objScale * TheInGameUI-> getUnitInfoScaleFactor () ;
37573756
37583757 //
3759- // take the center position of the object , go down to it's bottom extent, and project
3758+ // take the center position of the health region , go down to it's bottom extent, and project
37603759 // that point to the screen, that will be the "center" of our veterancy box
37613760 //
37623761
@@ -3766,11 +3765,7 @@ void Drawable::drawVeterancy( const IRegion2D *healthBarRegion )
37663765 if ( !TheTacticalView->worldToScreen ( &p, &screenCenter ) )
37673766 return ;
37683767
3769- Real healthBoxWidth, healthBoxHeight;
3770- if (!obj->getHealthBoxDimensions (healthBoxHeight, healthBoxWidth))
3771- return ;
3772-
3773- screenCenter.x += healthBoxWidth * scale * 0 .5f ;
3768+ screenCenter.x += healthBarRegion->width () * 0 .65f ;
37743769
37753770 // draw the image
37763771 TheDisplay->drawImage (image, screenCenter.x + 1 , screenCenter.y + 1 , screenCenter.x + 1 + vetBoxWidth, screenCenter.y + 1 + vetBoxHeight);
@@ -3878,23 +3873,24 @@ void Drawable::drawHealthBar(const IRegion2D* healthBarRegion)
38783873
38793874 }
38803875
3876+ Real healthBoxWidth = healthBarRegion->width ();
3877+ Real healthBoxHeight = max ((Int)defaultHealthBoxHeight, healthBarRegion->height ());
3878+ // TheSuperHackers @info For now we are integer scaling the health box height so we do the same for the health box outline
3879+ Real healthBoxOutlineSize = floorf ( (healthBarRegion->height () / (Int)defaultHealthBoxHeight) );
38813880
3882-
3883-
3884- // / Real scale = 1.3f / TheTacticalView->getZoom();
3885- Real healthBoxWidth = healthBarRegion->hi .x - healthBarRegion->lo .x ;
3886-
3887- Real healthBoxHeight = max (3 , healthBarRegion->hi .y - healthBarRegion->lo .y );
3888- Real healthBoxOutlineSize = 1 .0f ;
3881+ // draw a filled bar for the health
3882+ // TheSuperHackers @info this takes up the whole size of the health rect area, the border is drawn over the top
3883+ // This simplifies the handling of the health bar
3884+ TheDisplay->drawFillRect ( healthBarRegion->lo .x , healthBarRegion->lo .y ,
3885+ healthBoxWidth * healthRatio, healthBoxHeight,
3886+ color );
38893887
38903888 // draw the health box outline
3891- TheDisplay->drawOpenRect ( healthBarRegion->lo .x , healthBarRegion->lo .y , healthBoxWidth, healthBoxHeight,
3889+ // TheSuperHackers @info when drawing the outline, the underlying function grows the outline towards the center of the region
3890+ TheDisplay->drawOpenRect ( healthBarRegion->lo .x , healthBarRegion->lo .y ,
3891+ healthBoxWidth, healthBoxHeight,
38923892 healthBoxOutlineSize, outlineColor );
38933893
3894- // draw a filled bar for the health
3895- TheDisplay->drawFillRect ( healthBarRegion->lo .x + 1 , healthBarRegion->lo .y + 1 ,
3896- (healthBoxWidth - 2 ) * healthRatio, healthBoxHeight - 2 ,
3897- color );
38983894 }
38993895
39003896}
0 commit comments