Files
BT412/scratchpad/bgfbounds.py
T
arcattackandClaude Fable 5 5236d4263a Wreck sink (quadratic burial) + ldbr debris field -- the 1996 script completed
Answers "does the wreck fade away?": YES, by sinking.  FUN_00456410 (the 1996
sink renderable) computes offsetY = rate * t^2; the hulk's authored rate is
-0.025 -> the ~7-unit hulk is fully underground ~17s after the kill.  The
script also pairs the standing hulk with the LDBR strewn-debris field (12x13u
flat scatter), parented together and sinking together.

Also verified from the mesh data: BLHDBR (1537 verts -- more than the intact
torso) IS the authored Blackhawk wreck: the classic standing-leg-in-rubble
sculpt.  The "just a leg standing there" report is the authentic art.
(THRDBR -- the mesh the 1996 script hardcoded -- parses to ZERO vertices;
more evidence the hardcode was an unfinished dev shortcut.)

Implementation: SwapToWreck adds the ldbr piece; TickWreck applies the
quadratic sink per frame (driven from the dead mech's UpdateDeathState),
hides both pieces at burial and reports it so the wreck-smoke re-arm stops
with the wreck.  DPLStaticChildRenderable::SetOffsetTranslation added
(Execute re-reads OrientationMatrix per frame -- same in-place idiom as
SetDrawObj).

Lifecycle verified live: kill -> 'blhdbr.bgf' + ldbr debris -> smoke re-arm
@10s -> wreck buried @~17s -> smoke stops.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-08 15:55:01 -05:00

48 lines
1.7 KiB
Python

import struct, sys
VTX_TAGS = {0x80: 12, 0x81: 24, 0x82: 28, 0x88: 20, 0x89: 32, 0x8A: 36}
CONTAINERS = {0x03, 0x40, 0x41, 0x42, 0x46, 0x48, 0x70} # HEADER OBJECT LOD PATCH PMESH SPHERE_LIST BOUND
def bounds(path):
data = open(path, 'rb').read()
assert data[:8] == b'DIV-BIZ2', path
lo = [1e9, 1e9, 1e9]
hi = [-1e9, -1e9, -1e9]
nverts = 0
def walk(pos, end):
nonlocal nverts
while pos < end - 2:
tagword, = struct.unpack_from('<H', data, pos)
tag = tagword & 0x2fff
wide = (tagword >> 14) & 3
if wide == 1:
ln, = struct.unpack_from('<H', data, pos + 2)
hdr = 4
else:
ln = data[pos + 2]
hdr = 3
payload = pos + hdr
if tag in VTX_TAGS:
stride = VTX_TAGS[tag]
n = ln // stride
for i in range(n):
x, y, z = struct.unpack_from('<3f', data, payload + i * stride)
for a, v in enumerate((x, y, z)):
if v < lo[a]: lo[a] = v
if v > hi[a]: hi[a] = v
nverts += n
elif tag in CONTAINERS:
walk(payload, payload + ln)
pos = payload + ln
walk(8, len(data))
print('%-14s verts=%5d X[%7.2f %7.2f] Y[%7.2f %7.2f] Z[%7.2f %7.2f]'
% (path.split('\\')[-1], nverts, lo[0], hi[0], lo[1], hi[1], lo[2], hi[2]))
base = r'C:\git\bt411\content\VIDEO\GEO\%s'
for f in ['LDBR.BGF', 'MDBR.BGF', 'FLAMESML.BGF', 'FLAMEBIG.BGF']:
try:
bounds(base % f)
except Exception as e:
print(f, 'ERR', e)