Gauges: temp/status bar tiles the striped pattern from x=0 (HorizTwoPartBar)

The per-weapon TEMP/STATUS bar (HorizTwoPartBar) rendered as a solid block
starting at the warn-threshold pixel -- it "started in the middle" and was
never striped.  The port's Execute had been rewritten with DrawFilledRectangle
and never used the interned tile image, unlike the (correct) VertTwoPartBar
which tiles via DrawTiledBitmap.

Restored the binary's three-zone render (disasm @004c4340), along X:
  [0, warnPix)      DrawTiledBitmap(tileImage) -- the striped/dotted pattern
  [warnPix, valPix) backgroundColor solid (only when value > low)
  [valPix, width)   fillColor solid
So the bar now fills the striped tile from the beginning and matches the
reference (hatched fill block on the left + dotted tick scale).  Render-
verified vs the DOSBox reference capture.  Both builds clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
arcattack
2026-07-21 08:03:41 -05:00
co-authored by Claude Opus 4.8
parent cfc7b27ba3
commit 4d4436ed03
+32 -13
View File
@@ -1737,33 +1737,52 @@ void HorizTwoPartBar::BecameActive() // @004c4324
// //
// @004c4340 -- Execute: clamp value to [0,high], map value/warn to bar pixels // @004c4340 -- Execute: clamp value to [0,high], map value/warn to bar pixels
// (half-up round of width*x/high), repaint on change (mirror of VertTwoPartBar // (half-up round of width*x/high), repaint on change. THREE zones along X
// but along X). // (mirror of VertTwoPartBar along Y):
// [0, warnPix) striped TILE pattern (DrawTiledBitmap @004c4482)
// [warnPix, valPix) backgroundColor solid (only when value > low) @004c449d
// [valPix, width) fillColor solid @004c44da
// FIX 2026-07-21: the port had solid-filled from warnPix (no tile, no [0,warnPix]
// zone) -- so the bar read as "starts in the middle" + "not striped". Restored
// the tiled first zone + the correct zone colours from the binary disasm.
// //
void HorizTwoPartBar::Execute() void HorizTwoPartBar::Execute()
{ {
if (value < 0.0f) value = 0.0f; if (value < 0.0f) value = 0.0f; // @004c434c fcomp 0.0
else if (value > high) value = high; else if (value > high) value = high; // @004c4367 fcomp high
int warnPix = (int)((Scalar)width * low / high + 0.5f); int warnPix = (int)((Scalar)width * low / high + 0.5f); // low/warn threshold pixel
int valPix = (int)((Scalar)width * value / high + 0.5f); int valPix = (int)((Scalar)width * value / high + 0.5f); // current value pixel
if (warnPix < 0) warnPix = 0; else if (warnPix > width) warnPix = width; if (warnPix < 0) warnPix = 0; else if (warnPix > width) warnPix = width;
if (valPix < 0) valPix = 0; else if (valPix > width) valPix = width; if (valPix < 0) valPix = 0; else if (valPix > width) valPix = width;
if (warnPix != previousFull || valPix != previousFill) if (warnPix != previousFull || valPix != previousFill)
{ {
if (warnPix < valPix) // Zone 1 [0, warnPix): the striped tile (the binary's tiled blit, NOT a
{ // solid fill). SetColor(backgroundColor) is the tile's opaque backdrop.
localView.SetColor(fillColor); L4Warehouse *warehouse = (L4Warehouse *)renderer->warehousePointer;
localView.MoveToAbsolute(warnPix, 0); BitMap *tile = warehouse->bitMapBin.Get(tileImage); // FUN_00442aec
localView.DrawFilledRectangleToAbsolute(valPix - 1, height); localView.SetColor(backgroundColor); // vtbl+0x18 @004c443a
} DrawTiledBitmap(&localView, 0, 0, warnPix - 1, height, fillColor, tile);
if (valPix < width) warehouse->bitMapBin.Release(tileImage); // FUN_00442c12
// Zone 2 [warnPix, valPix): backgroundColor (binary keeps the current
// colour, still backgroundColor from zone 1) -- only when value > low.
if (valPix > warnPix)
{ {
localView.SetColor(backgroundColor); localView.SetColor(backgroundColor);
localView.MoveToAbsolute(warnPix, 0); // vtbl+0x24
localView.DrawFilledRectangleToAbsolute(valPix - 1, height); // vtbl+0x48
}
// Zone 3 [valPix, width): the solid fill colour.
if (valPix < width)
{
localView.SetColor(fillColor); // @004c44da
localView.MoveToAbsolute(valPix, 0); localView.MoveToAbsolute(valPix, 0);
localView.DrawFilledRectangleToAbsolute(width, height); localView.DrawFilledRectangleToAbsolute(width, height);
} }
previousFull = warnPix; previousFull = warnPix;
previousFill = valPix; previousFill = valPix;
} }