From 4d4436ed03972e60794ca130c0b67b412af15838 Mon Sep 17 00:00:00 2001 From: arcattack Date: Tue, 21 Jul 2026 08:03:41 -0500 Subject: [PATCH] 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) --- game/reconstructed/btl4gaug.cpp | 45 +++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/game/reconstructed/btl4gaug.cpp b/game/reconstructed/btl4gaug.cpp index a01ae2f..3e54f0c 100644 --- a/game/reconstructed/btl4gaug.cpp +++ b/game/reconstructed/btl4gaug.cpp @@ -1737,33 +1737,52 @@ void HorizTwoPartBar::BecameActive() // @004c4324 // // @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 -// but along X). +// (half-up round of width*x/high), repaint on change. THREE zones 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() { - if (value < 0.0f) value = 0.0f; - else if (value > high) value = high; + if (value < 0.0f) value = 0.0f; // @004c434c fcomp 0.0 + else if (value > high) value = high; // @004c4367 fcomp high - int warnPix = (int)((Scalar)width * low / high + 0.5f); - int valPix = (int)((Scalar)width * value / 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); // current value pixel if (warnPix < 0) warnPix = 0; else if (warnPix > width) warnPix = width; if (valPix < 0) valPix = 0; else if (valPix > width) valPix = width; if (warnPix != previousFull || valPix != previousFill) { - if (warnPix < valPix) - { - localView.SetColor(fillColor); - localView.MoveToAbsolute(warnPix, 0); - localView.DrawFilledRectangleToAbsolute(valPix - 1, height); - } - if (valPix < width) + // Zone 1 [0, warnPix): the striped tile (the binary's tiled blit, NOT a + // solid fill). SetColor(backgroundColor) is the tile's opaque backdrop. + L4Warehouse *warehouse = (L4Warehouse *)renderer->warehousePointer; + BitMap *tile = warehouse->bitMapBin.Get(tileImage); // FUN_00442aec + localView.SetColor(backgroundColor); // vtbl+0x18 @004c443a + DrawTiledBitmap(&localView, 0, 0, warnPix - 1, height, fillColor, tile); + 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.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.DrawFilledRectangleToAbsolute(width, height); } + previousFull = warnPix; previousFill = valPix; }