1. Index: view.c
  2. ===================================================================
  3. --- view.c (revision 2574)
  4. +++ view.c (working copy)
  5. @@ -3613,7 +3613,15 @@
  6.  
  7. // tweak as needed, this alters the transparency
  8. c1.a = 140;
  9. - drawIsoEnergyBar(Z_DIR, x, y, 1, 5, 5, w, PercentageDone, &c1, &c2);
  10. +
  11. + //Minimum width for the "health remaining" display bar in percentage form
  12. + float percent = 0.05;
  13. + //ensure the remaining health display shows at minimum "percent" health
  14. + if (PercentageDone > percent){
  15. + drawIsoEnergyBar(Z_DIR, x, y, 1, 5, 5, w, PercentageDone, &c1, &c2);
  16. + }else{
  17. + drawIsoEnergyBar(Z_DIR, x, y, 1, 5, 5, w, percent, &c1, &c2);
  18. + }
  19. }
  20.  
  21. #endif
  22. Index: hud.c
  23. ===================================================================
  24. --- hud.c (revision 2574)
  25. +++ hud.c (working copy)
  26. @@ -599,7 +599,7 @@
  27. 2.5 * FontHeight(BFont_to_use);
  28.  
  29. // Width of bars
  30. - bar_width = (text_length) * (cur_enemy->energy / Druidmap[cur_enemy->type].maxenergy);
  31. + bar_width = (text_length);
  32. barc_width = (text_length) * (1.0 - cur_enemy->energy / Druidmap[cur_enemy->type].maxenergy);
  33. if (bar_width < 0)
  34. bar_width = 0;
  35. @@ -618,10 +618,20 @@
  36. }
  37.  
  38. // Draw the energy bar complement
  39. - rect.x = bar_x + bar_width;
  40. + rect.x = bar_x;
  41. rect.y = bar_y;
  42. rect.w = barc_width;
  43. - our_SDL_fill_rect_wrapper(Screen, &rect, SDL_MapRGB(Screen->format, 0x000, 0x000, 0x000));
  44. +
  45. + //Minimum width for the "health remaining" display bar in percentage form
  46. + float percent = 0.005;
  47. +
  48. + //The "if" and "else" statement ensures that the health-bar displays of at least percentage*bar_width remaining health
  49. + if (barc_width < (bar_width*(1 - percent))){
  50. + our_SDL_fill_rect_wrapper(Screen, &rect, SDL_MapRGB(Screen->format, 0x000, 0x000, 0x000));
  51. + }else{
  52. + rect.w = bar_width*(percent);
  53. + our_SDL_fill_rect_wrapper(Screen, &rect, SDL_MapRGB(Screen->format, 0x000, 0x000, 0x000));
  54. + }
  55.  
  56. // Display droid's short description text
  57. rect.x = translate_map_point_to_screen_pixel_x(description_pos->x, description_pos->y) - text_length / 2;