Files
BT411/game/reconstructed/dpl2d.hpp
T
arcattackandClaude Opus 4.8 7b7d465e5e Initial commit: bt411 -- standalone Windows BattleTech (Tesla 4.10 port)
Clean, self-contained extraction of the BattleTech-specific work from the
reverse-engineering workspace -- engine + game + content + build, with nothing
from Red Planet or the raw archive dumps. Builds green (Win32) and runs the
single-player drive->animate->target->fire->damage->destroy loop out of the box.

Layout:
  engine/   MUNGA + MUNGA_L4 shared 2007 engine, carrying our BT render/loader
            work (bgfload/L4D3D/L4VIDEO: BSL bit-slice decode, LOD/ground/shadow
            models) + image codec; the minimal rp/ headers the audio HAL needs
  game/     reconstructed BT logic + surviving-original BT source + fwd shims
            + WinMain launcher
  content/  full runtime tree (BTL4.RES, VIDEO/, GAUGE/, AUDIO/, eggs, BTDPL.INI)
  docs/     format specs + reconstruction ledgers
  reference/ raw Ghidra pseudocode (recon source-of-truth) + decomp exporter
  tools/    MP console emulator + map/resource scanners

One top-level CMake builds munga_engine lib + bt410_l4 game lib + btl4.exe.
All paths relativized (186 fwd shims + ~437 CMake abs paths -> repo-relative);
DXSDK is the one external, overridable via -DDXSDK. Verified: builds to a
byte-identical 2.27MB exe and runs combat (TARGET DESTROYED, 0 crashes) against
the bundled content.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-05 21:03:40 -05:00

44 lines
2.7 KiB
C++

//===========================================================================//
// File: dpl2d.hpp //
// Project: BattleTech port (WinTesla / btl4) //
//---------------------------------------------------------------------------//
// The legacy libDPL 2D vector display-list layer, re-hosted over Direct3D 9. //
// //
// The original BattleTech build drew the out-the-window HUD vector overlay //
// (targeting reticle, PIP blip markers, range arcs) through libDPL's //
// dpl2d_* display-list API, executed on the Division IG board. WinTesla's //
// L4D3D renderer never reimplemented that layer, so it shipped as inert //
// stubs (btstubs.cpp). This module replaces those stubs with a real //
// recorder + a Direct3D9 executor: //
// //
// * The dpl2d_* recording calls (declared in btl4vid.hpp) build an //
// in-memory command list (color / circle outline / circle fill / //
// pen moves under a translation matrix stack). //
// * dpl2d_ExecuteList() rasterises a compiled list as screen-space 2D //
// primitives (pre-transformed L4VERTEX_2D quads / fans / line strips) //
// on the supplied device -- the same vertex form L4D3D / L4VB16 use. //
// //
// Coordinates handed to the recorder are normalised view coordinates in //
// [0,1] across the active D3D viewport (origin top-left); the executor maps //
// them to pixels at draw time. (Normalisation basis is best-effort -- see //
// dpl2d.cpp -- and easy to retune once the reticle is verified on-screen.) //
//===========================================================================//
#if !defined(DPL2D_HPP)
# define DPL2D_HPP
struct IDirect3DDevice9; // forward (full def via <d3d9.h> in dpl2d.cpp)
class dpl2d_DISPLAY; // opaque list handle (DPLSTUB.h)
//
// Rasterise a compiled dpl2d display list onto `device`, using the device's
// current viewport for the normalised->pixel mapping. Safe to call with a
// NULL list or device (no-op). Saves and restores the render states it
// touches. Intended to be called by the world-view renderer each frame after
// the 3D scene is drawn (e.g. BTReticleRenderable::Execute -> here), once the
// reticle display lists built in btl4vid.cpp are wired to an execution point.
//
void dpl2d_ExecuteList(dpl2d_DISPLAY *list, IDirect3DDevice9 *device);
#endif