Files
BT412/game/reconstructed/btl4rdr.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

245 lines
4.5 KiB
C++

//===========================================================================//
// File: btl4gaug.hh //
// Project: MUNGA Brick: Gauge Renderer Manager //
// Contents: //
//---------------------------------------------------------------------------//
// Date Who Modification //
// -------- --- ---------------------------------------------------------- //
// 09/13/95 CPB Initial coding. //
//---------------------------------------------------------------------------//
// Copyright (C) 1994, Virtual World Entertainment, Inc. All rights reserved //
// PROPRIETARY and CONFIDENTIAL //
//===========================================================================//
//
// SURVIVING HEADER -- recovered verbatim from
// 410SRC/Telsa40/Rel410/CODE/BT/BT_L4/BTL4RDR.HPP
// This is the authoritative class declaration; btl4rdr.cpp is reconstructed
// to match it. (The shipped object's member byte-offsets confirm this layout
// exactly: offsetPosition@0x2D0 ... shadowTable@0x3C4. See btl4rdr.cpp.)
//
#if !defined(BTL4RDR_HPP)
# define BTL4RDR_HPP
# if !defined(SLOT_HPP)
# include <slot.hpp>
# endif
# if !defined(L4GREND_HPP)
# include <l4grend.hpp>
# endif
# if !defined(L4GAUGE_HPP)
# include <l4gauge.hpp>
# endif
# if !defined(ROTATION_HPP)
# include <rotation.hpp>
# endif
# if !defined(RANDOM_HPP)
# include <random.hpp>
# endif
# if !defined(POINT3D_HPP)
# include "point3d.hpp"
# endif
# if !defined(HEAT_HPP)
# include <heat.hpp>
# endif
# if !defined(POWERSUB_HPP)
# include <powersub.hpp>
# endif
struct ShadowRecord
{
int distance;
};
class MapDisplay;
class MapName SIGNATURED // Used exclusively by MapDisplay
{
friend class MapDisplay;
MapName()
{}
~MapName()
{}
Logical
TestInstance() const
{
return True;
}
protected:
void
ExtractFromEntity(
Entity *entity,
AffineMatrix &worldToView,
Entity *exclude_entity=NULL,
Entity *hotbox_entity=NULL
);
void
Draw(
GraphicsView *graphics_view,
int hotbox_color
);
Point3D
center;
Vector3D
direction;
BitMap
*nameBitmap;
int
color;
Logical
hotBoxed;
};
class MapDisplay :
public GraphicGauge
{
public:
enum OffsetPosition
{
center,
bottom
};
static MethodDescription
methodDescription;
static Logical
Make(
int display_port_index,
Vector2DOf<int> position,
Entity *entity,
GaugeRenderer *gauge_renderer
);
MapDisplay(
GaugeRate rate,
ModeMask mode_mask,
L4GaugeRenderer *renderer,
unsigned int owner_ID,
int graphics_port_number,
int left, int bottom,
int right, int top,
OffsetPosition offset_position,
int view_width_in_degrees,
int bg_color,
int static_color,
int hotbox_color,
Scalar maximum_range,
Entity *entity,
Scalar *scale_value_pointer,
Point3D **position_pointer,
Quaternion **angle_pointer,
Scalar *capabilities_ratio,
Logical allow_rock_and_roll=False
);
~MapDisplay();
Logical
TestInstance() const;
void
ShowInstance(char *indent);
void
BecameActive();
void
Execute();
protected:
void
CalculateBounds();
void
EraseDisplay();
void
DrawDisplay();
void
BuildRadarShadow(AffineMatrix &worldToView);
void
DrawViewWedge();
void
DrawStatic(AffineMatrix &worldToView);
void
DrawMoving(AffineMatrix &worldToView);
void
DrawNames(AffineMatrix &worldToView);
enum
{
maximumNames = 16
};
MapName
nameArray[maximumNames];
OffsetPosition
offsetPosition;
Scalar
currentScale;
Point3D *
currentPositionPointer;
Quaternion *
currentAngularPointer;
Scalar
currentCapabilitiesRatio;
Scalar
LODIndex,
pixelsPerMeter,
metersPerPixel,
maximumRange,
maximumDistanceSquared,
xMin,
yMin,
zMin,
xMax,
yMax,
zMax;
Point3D
viewingPosition;
Radian
viewHorizontalRotation;
Radian
viewHalfHorizontalWidth;
AffineMatrix
worldToView;
int
operatingPhase,
backgroundColor,
staticColor,
boxColor,
halfWidth,
halfHeight;
Logical
operating,
rockAndRoll,
flashState;
GaugeEntityList
staticEntityList,
movingEntityList;
GraphicsViewRecord
previousDrawing;
int
halfViewWidthInUnits;
ShadowRecord
*shadowTable;
};
#endif